get.porter.sh/porter@v1.3.0/cmd/porter/explain.go (about) 1 package main 2 3 import ( 4 "get.porter.sh/porter/pkg/porter" 5 "github.com/spf13/cobra" 6 ) 7 8 func buildBundleExplainCommand(p *porter.Porter) *cobra.Command { 9 10 opts := porter.ExplainOpts{} 11 cmd := cobra.Command{ 12 Use: "explain REFERENCE", 13 Short: "Explain a bundle", 14 Long: "Explain how to use a bundle by printing the parameters, credentials, outputs, actions.", 15 Example: ` porter bundle explain 16 porter bundle explain ghcr.io/getporter/examples/porter-hello:v0.2.0 17 porter bundle explain localhost:5000/ghcr.io/getporter/examples/porter-hello:v0.2.0 --insecure-registry --force 18 porter bundle explain --file another/porter.yaml 19 porter bundle explain --cnab-file some/bundle.json 20 porter bundle explain --action install 21 `, 22 PreRunE: func(cmd *cobra.Command, args []string) error { 23 return opts.Validate(args, p.Context) 24 }, 25 RunE: func(cmd *cobra.Command, args []string) error { 26 return p.Explain(cmd.Context(), opts) 27 }, 28 } 29 f := cmd.Flags() 30 addBundleDefinitionFlags(f, &opts.BundleDefinitionOptions) 31 f.StringVarP(&opts.RawFormat, "output", "o", "plaintext", 32 "Specify an output format. Allowed values: plaintext, json, yaml") 33 f.StringVar(&opts.Action, "action", "", "Hide parameters and outputs that are not used by the specified action.") 34 addBundlePullFlags(f, &opts.BundlePullOptions) 35 36 return &cmd 37 }