github.com/openshift/installer@v1.4.17/cmd/openshift-install/features.go (about)

     1  package main
     2  
     3  import (
     4  	"encoding/json"
     5  	"fmt"
     6  	"strings"
     7  
     8  	"github.com/sirupsen/logrus"
     9  	"github.com/spf13/cobra"
    10  )
    11  
    12  var (
    13  	outputJSON     = false
    14  	hiddenFeatures = []string{
    15  		"terraform-spot-masters",
    16  	}
    17  )
    18  
    19  func newListFeaturesCmd() *cobra.Command {
    20  	cmd := &cobra.Command{
    21  		Use:    "list-hidden-features",
    22  		Short:  "List supported hidden features",
    23  		Long:   "",
    24  		Hidden: true,
    25  		Args:   cobra.ExactArgs(0),
    26  		Run: func(_ *cobra.Command, _ []string) {
    27  			var out string
    28  			if outputJSON {
    29  				outb, err := json.Marshal(hiddenFeatures)
    30  				if err != nil {
    31  					logrus.Fatalf("failed to marshal output: %s", err.Error())
    32  				}
    33  				out = string(outb)
    34  			} else {
    35  				out = strings.Join(hiddenFeatures, "\n")
    36  			}
    37  			fmt.Println(out)
    38  		},
    39  	}
    40  	cmd.PersistentFlags().BoolVar(&outputJSON, "json", false, "print output in json format")
    41  	return cmd
    42  }