github.com/jenkins-x/jx/v2@v2.1.155/pkg/cmd/step/e2e/step_e2e.go (about)

     1  package e2e
     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  // StepE2EOptions contains the command line flags
    11  type StepE2EOptions struct {
    12  	step.StepOptions
    13  }
    14  
    15  // NewCmdStepE2E Steps a command object for the "e2e" command
    16  func NewCmdStepE2E(commonOpts *opts.CommonOptions) *cobra.Command {
    17  	options := &StepE2EOptions{
    18  		StepOptions: step.StepOptions{
    19  			CommonOptions: commonOpts,
    20  		},
    21  	}
    22  
    23  	cmd := &cobra.Command{
    24  		Use:   "e2e",
    25  		Short: "e2e [command]",
    26  		Run: func(cmd *cobra.Command, args []string) {
    27  			options.Cmd = cmd
    28  			options.Args = args
    29  			err := options.Run()
    30  			helper.CheckErr(err)
    31  		},
    32  	}
    33  	cmd.AddCommand(NewCmdStepE2ELabel(commonOpts))
    34  	cmd.AddCommand(NewCmdStepE2EGC(commonOpts))
    35  	return cmd
    36  }
    37  
    38  // Run implements this command
    39  func (o *StepE2EOptions) Run() error {
    40  	return o.Cmd.Help()
    41  }