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

     1  package create
     2  
     3  import (
     4  	"github.com/olli-ai/jx/v2/pkg/cmd/create/options"
     5  	"github.com/olli-ai/jx/v2/pkg/cmd/helper"
     6  	"github.com/olli-ai/jx/v2/pkg/cmd/opts"
     7  	"github.com/spf13/cobra"
     8  )
     9  
    10  // CreateJenkinsOptions the options for the create spring command
    11  type CreateJenkinsOptions struct {
    12  	options.CreateOptions
    13  }
    14  
    15  // NewCmdCreateJenkins creates a command object for the "create" command
    16  func NewCmdCreateJenkins(commonOpts *opts.CommonOptions) *cobra.Command {
    17  	options := &CreateJenkinsOptions{
    18  		CreateOptions: options.CreateOptions{
    19  			CommonOptions: commonOpts,
    20  		},
    21  	}
    22  
    23  	cmd := &cobra.Command{
    24  		Use:   "jenkins",
    25  		Short: "Creates a Jenkins resource",
    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  
    34  	cmd.AddCommand(NewCmdCreateJenkinsUser(commonOpts))
    35  	return cmd
    36  }
    37  
    38  // Run implements this command
    39  func (o *CreateJenkinsOptions) Run() error {
    40  	return o.Cmd.Help()
    41  }