get.porter.sh/porter@v1.3.0/cmd/exec/invoke.go (about) 1 package main 2 3 import ( 4 "get.porter.sh/porter/pkg/exec" 5 "github.com/spf13/cobra" 6 ) 7 8 func buildInvokeCommand(m *exec.Mixin) *cobra.Command { 9 opts := exec.ExecuteOptions{} 10 11 cmd := &cobra.Command{ 12 Use: "invoke", 13 Short: "Execute the invoke functionality of this mixin", 14 RunE: func(cmd *cobra.Command, args []string) error { 15 return m.Execute(cmd.Context(), opts) 16 }, 17 } 18 flags := cmd.Flags() 19 flags.StringVarP(&opts.File, "file", "f", "", "Path to the script to execute") 20 21 // Define a flag for --action so that its presence doesn't cause errors, but ignore it since exec doesn't need it 22 var action string 23 flags.StringVar(&action, "action", "", "Custom action name to invoke.") 24 25 return cmd 26 }