github.com/jenkins-x/jx/v2@v2.1.155/pkg/cmd/step/cluster/step_cluster.go (about) 1 package cluster 2 3 import ( 4 "github.com/jenkins-x/jx/v2/pkg/cmd/helper" 5 "github.com/jenkins-x/jx/v2/pkg/cmd/opts" 6 "github.com/jenkins-x/jx/v2/pkg/cmd/opts/step" 7 "github.com/spf13/cobra" 8 ) 9 10 // StepClusterOptions contains the command line flags and other helper objects 11 type StepClusterOptions struct { 12 step.StepOptions 13 ClusterOptions opts.ClusterOptions 14 } 15 16 // NewCmdStepCluster Creates a new Command object 17 func NewCmdStepCluster(commonOpts *opts.CommonOptions) *cobra.Command { 18 options := &StepClusterOptions{ 19 StepOptions: step.StepOptions{ 20 CommonOptions: commonOpts, 21 }, 22 } 23 24 cmd := &cobra.Command{ 25 Use: "cluster", 26 Short: "cluster [kind]", 27 Run: func(cmd *cobra.Command, args []string) { 28 options.Cmd = cmd 29 options.Args = args 30 err := options.Run() 31 helper.CheckErr(err) 32 }, 33 } 34 cmd.AddCommand(NewCmdStepClusterLabel(commonOpts)) 35 cmd.AddCommand(NewCmdStepClusterLock(commonOpts)) 36 cmd.AddCommand(NewCmdStepClusterUnlock(commonOpts)) 37 return cmd 38 } 39 40 // Run implements this command 41 func (o *StepClusterOptions) Run() error { 42 return o.Cmd.Help() 43 }