get.porter.sh/porter@v1.3.0/cmd/porter/inspect.go (about)

     1  package main
     2  
     3  import (
     4  	"get.porter.sh/porter/pkg/porter"
     5  	"github.com/spf13/cobra"
     6  )
     7  
     8  func buildBundleInspectCommand(p *porter.Porter) *cobra.Command {
     9  	opts := porter.ExplainOpts{}
    10  	cmd := cobra.Command{
    11  		Use:   "inspect REFERENCE",
    12  		Short: "Inspect a bundle",
    13  		Long: `Inspect a bundle by printing the bundle images and any related images images.
    14  
    15  If you would like more information about the bundle, the porter explain command will provide additional information,
    16  like parameters, credentials, outputs and custom actions available.
    17  `,
    18  		Example: `  porter bundle inspect
    19    porter bundle inspect ghcr.io/getporter/examples/porter-hello:v0.2.0
    20    porter bundle inspect localhost:5000/ghcr.io/getporter/examples/porter-hello:v0.2.0 --insecure-registry --force
    21    porter bundle inspect --file another/porter.yaml
    22    porter bundle inspect --cnab-file some/bundle.json
    23  		  `,
    24  		PreRunE: func(cmd *cobra.Command, args []string) error {
    25  			return opts.Validate(args, p.Context)
    26  		},
    27  		RunE: func(cmd *cobra.Command, args []string) error {
    28  			return p.Inspect(cmd.Context(), opts)
    29  		},
    30  	}
    31  	f := cmd.Flags()
    32  	addBundleDefinitionFlags(f, &opts.BundleDefinitionOptions)
    33  	f.StringVarP(&opts.RawFormat, "output", "o", "plaintext",
    34  		"Specify an output format.  Allowed values: plaintext, json, yaml")
    35  	addBundlePullFlags(f, &opts.BundlePullOptions)
    36  	return &cmd
    37  }