get.porter.sh/porter@v1.3.0/cmd/porter/run.go (about) 1 package main 2 3 import ( 4 "get.porter.sh/porter/pkg/porter" 5 "github.com/spf13/cobra" 6 ) 7 8 func buildRunCommand(p *porter.Porter) *cobra.Command { 9 opts := porter.NewRunOptions(p.Config) 10 cmd := &cobra.Command{ 11 Use: "run", 12 Short: "Execute runtime bundle instructions", 13 Long: "Execute the runtime bundle instructions contained in a porter configuration file", 14 PreRunE: func(cmd *cobra.Command, args []string) error { 15 return opts.Validate() 16 }, 17 RunE: func(cmd *cobra.Command, args []string) error { 18 return p.Run(cmd.Context(), opts) 19 }, 20 Hidden: true, // Hide runtime commands from the helptext 21 } 22 23 flags := cmd.Flags() 24 flags.StringVarP(&opts.File, "file", "f", "porter.yaml", "The porter configuration file (Defaults to porter.yaml)") 25 flags.StringVar(&opts.Action, "action", "", "The bundle action to execute (Defaults to CNAB_ACTION)") 26 flags.BoolVar(&opts.DebugMode, "debug", false, "Enable debug mode for the bundle") 27 28 cmd.Annotations = map[string]string{ 29 "group": "runtime", 30 } 31 32 return cmd 33 }