github.com/jenkins-x/jx/v2@v2.1.155/pkg/cmd/create/create_git.go (about) 1 package create 2 3 import ( 4 "github.com/jenkins-x/jx/v2/pkg/cmd/create/options" 5 "github.com/jenkins-x/jx/v2/pkg/cmd/helper" 6 "github.com/jenkins-x/jx/v2/pkg/cmd/opts" 7 "github.com/spf13/cobra" 8 ) 9 10 // CreateGitOptions the options for the create spring command 11 type CreateGitOptions struct { 12 options.CreateOptions 13 } 14 15 // NewCmdCreateGit creates a command object for the "create" command 16 func NewCmdCreateGit(commonOpts *opts.CommonOptions) *cobra.Command { 17 options := &CreateGitOptions{ 18 CreateOptions: options.CreateOptions{ 19 CommonOptions: commonOpts, 20 }, 21 } 22 23 cmd := &cobra.Command{ 24 Use: "git", 25 Short: "Creates a Git resource", 26 Aliases: []string{"scm"}, 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 35 cmd.AddCommand(NewCmdCreateGitServer(commonOpts)) 36 cmd.AddCommand(NewCmdCreateGitToken(commonOpts)) 37 cmd.AddCommand(NewCmdCreateGitUser(commonOpts)) 38 return cmd 39 } 40 41 // Run implements this command 42 func (o *CreateGitOptions) Run() error { 43 return o.Cmd.Help() 44 }