github.com/olli-ai/jx/v2@v2.0.400-0.20210921045218-14731b4dd448/pkg/cmd/step/update/step_update.go (about)

     1  package update
     2  
     3  import (
     4  	"github.com/olli-ai/jx/v2/pkg/cmd/helper"
     5  	"github.com/olli-ai/jx/v2/pkg/cmd/opts"
     6  	"github.com/olli-ai/jx/v2/pkg/cmd/opts/step"
     7  	"github.com/olli-ai/jx/v2/pkg/cmd/step/update/release"
     8  	"github.com/spf13/cobra"
     9  )
    10  
    11  // NewCmdStepUpdate Steps a command object for the "step" command
    12  func NewCmdStepUpdate(commonOpts *opts.CommonOptions) *cobra.Command {
    13  	options := &step.StepUpdateOptions{
    14  		StepOptions: step.StepOptions{
    15  			CommonOptions: commonOpts,
    16  		},
    17  	}
    18  
    19  	cmd := &cobra.Command{
    20  		Use:   "update",
    21  		Short: "update [command]",
    22  		Run: func(cmd *cobra.Command, args []string) {
    23  			options.Cmd = cmd
    24  			options.Args = args
    25  			err := options.Run()
    26  			helper.CheckErr(err)
    27  		},
    28  	}
    29  
    30  	cmd.AddCommand(release.NewCmdStepUpdateRelease(commonOpts))
    31  	return cmd
    32  }
    33  
    34  //StepUpdateCommand is the options for NewCmdStepUpdate
    35  type StepUpdateCommand struct {
    36  	step.StepUpdateOptions
    37  }
    38  
    39  // Run implements this command
    40  func (o *StepUpdateCommand) Run() error {
    41  	return o.Cmd.Help()
    42  }