github.com/jenkins-x/jx/v2@v2.1.155/pkg/cmd/deletecmd/delete_chat.go (about)

     1  package deletecmd
     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/spf13/cobra"
     7  )
     8  
     9  // DeleteChatOptions are the flags for delete commands
    10  type DeleteChatOptions struct {
    11  	*opts.CommonOptions
    12  }
    13  
    14  // NewCmdDeleteChat creates a command object for the generic "get" action, which
    15  // retrieves one or more resources from a server.
    16  func NewCmdDeleteChat(commonOpts *opts.CommonOptions) *cobra.Command {
    17  	options := &DeleteChatOptions{
    18  		commonOpts,
    19  	}
    20  
    21  	cmd := &cobra.Command{
    22  		Use:     "chat",
    23  		Short:   "Deletes one or more chat services resources",
    24  		Aliases: []string{"slack"},
    25  		Run: func(cmd *cobra.Command, args []string) {
    26  			options.Cmd = cmd
    27  			options.Args = args
    28  			err := options.Run()
    29  			helper.CheckErr(err)
    30  		},
    31  	}
    32  
    33  	cmd.AddCommand(NewCmdDeleteChatServer(commonOpts))
    34  	cmd.AddCommand(NewCmdDeleteChatToken(commonOpts))
    35  	return cmd
    36  }
    37  
    38  // Run implements this command
    39  func (o *DeleteChatOptions) Run() error {
    40  	return o.Cmd.Help()
    41  }