github.com/jenkins-x/jx/v2@v2.1.155/pkg/cmd/create/create_chat.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 // CreateChatOptions the options for the create spring command 11 type CreateChatOptions struct { 12 options.CreateOptions 13 } 14 15 // NewCmdCreateChat creates a command object for the "create" command 16 func NewCmdCreateChat(commonOpts *opts.CommonOptions) *cobra.Command { 17 options := &CreateChatOptions{ 18 CreateOptions: options.CreateOptions{ 19 CommonOptions: commonOpts, 20 }, 21 } 22 23 cmd := &cobra.Command{ 24 Use: "chat", 25 Short: "Creates a chat server resource", 26 Aliases: []string{"slackr"}, 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(NewCmdCreateChatServer(commonOpts)) 36 cmd.AddCommand(NewCmdCreateChatToken(commonOpts)) 37 return cmd 38 } 39 40 // Run implements this command 41 func (o *CreateChatOptions) Run() error { 42 return o.Cmd.Help() 43 }