diff options
author | Christopher Speller <crspeller@gmail.com> | 2018-05-17 12:40:40 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-17 12:40:40 -0700 |
commit | 11cbb597471127c1b29e78e6cad0a1a4d93ea24c (patch) | |
tree | 0eceb950872c7234348f0b41d4492073908840d0 /cmd/commands/command.go | |
parent | 1f6c271b3bedd6656ae7155714423b1b39a669c1 (diff) | |
download | chat-11cbb597471127c1b29e78e6cad0a1a4d93ea24c.tar.gz chat-11cbb597471127c1b29e78e6cad0a1a4d93ea24c.tar.bz2 chat-11cbb597471127c1b29e78e6cad0a1a4d93ea24c.zip |
Renaming platform binary to mattermost. (#8801)
Diffstat (limited to 'cmd/commands/command.go')
-rw-r--r-- | cmd/commands/command.go | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/cmd/commands/command.go b/cmd/commands/command.go deleted file mode 100644 index e7b7e0a0d..000000000 --- a/cmd/commands/command.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -package commands - -import ( - "errors" - - "github.com/mattermost/mattermost-server/app" - "github.com/mattermost/mattermost-server/cmd" - "github.com/mattermost/mattermost-server/model" - "github.com/spf13/cobra" -) - -var CommandCmd = &cobra.Command{ - Use: "command", - Short: "Management of slash commands", -} - -var CommandMoveCmd = &cobra.Command{ - Use: "move", - Short: "Move a slash command to a different team", - Long: `Move a slash command to a different team. Commands can be specified by [team]:[command-trigger-word]. ie. myteam:trigger or by command ID.`, - Example: ` command move newteam oldteam:command`, - RunE: moveCommandCmdF, -} - -func init() { - CommandCmd.AddCommand( - CommandMoveCmd, - ) - cmd.RootCmd.AddCommand(CommandCmd) -} - -func moveCommandCmdF(command *cobra.Command, args []string) error { - a, err := cmd.InitDBCommandContextCobra(command) - if err != nil { - return err - } - defer a.Shutdown() - - if len(args) < 2 { - return errors.New("Enter the destination team and at least one comamnd to move.") - } - - team := getTeamFromTeamArg(a, args[0]) - if team == nil { - return errors.New("Unable to find destination team '" + args[0] + "'") - } - - commands := getCommandsFromCommandArgs(a, args[1:]) - cmd.CommandPrintErrorln(commands) - for i, command := range commands { - if command == nil { - cmd.CommandPrintErrorln("Unable to find command '" + args[i+1] + "'") - continue - } - if err := moveCommand(a, team, command); err != nil { - cmd.CommandPrintErrorln("Unable to move command '" + command.Trigger + "' error: " + err.Error()) - } else { - cmd.CommandPrettyPrintln("Moved command '" + command.Trigger + "'") - } - } - - return nil -} - -func moveCommand(a *app.App, team *model.Team, command *model.Command) *model.AppError { - return a.MoveCommand(team, command) -} |