github.com/openshift/installer@v1.4.17/pkg/coreoscli/cmd.go (about) 1 package coreoscli 2 3 import ( 4 "context" 5 "os" 6 7 "github.com/spf13/cobra" 8 9 "github.com/openshift/installer/pkg/rhcos" 10 ) 11 12 // printStreamJSON is the implementation of print-stream-json 13 func printStreamJSON(cmd *cobra.Command, _ []string) error { 14 streamData, err := rhcos.FetchRawCoreOSStream(context.Background()) 15 if err != nil { 16 return err 17 } 18 os.Stdout.Write(streamData) 19 return nil 20 } 21 22 // NewCmd returns a subcommand for explain 23 func NewCmd() *cobra.Command { 24 cmd := &cobra.Command{ 25 Use: "coreos", 26 Short: "Commands for operating on CoreOS boot images", 27 Args: cobra.ExactArgs(0), 28 RunE: func(cmd *cobra.Command, args []string) error { 29 return cmd.Help() 30 }, 31 } 32 33 printStreamCmd := &cobra.Command{ 34 Use: "print-stream-json", 35 Short: "Outputs the CoreOS stream metadata for the bootimages", 36 Args: cobra.ExactArgs(0), 37 RunE: printStreamJSON, 38 } 39 cmd.AddCommand(printStreamCmd) 40 41 return cmd 42 }