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/commandargs.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/commandargs.go')
-rw-r--r-- | cmd/commands/commandargs.go | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/cmd/commands/commandargs.go b/cmd/commands/commandargs.go deleted file mode 100644 index 702f01c9a..000000000 --- a/cmd/commands/commandargs.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -package commands - -import ( - "fmt" - "strings" - - "github.com/mattermost/mattermost-server/app" - "github.com/mattermost/mattermost-server/model" -) - -const COMMAND_ARGS_SEPARATOR = ":" - -func getCommandsFromCommandArgs(a *app.App, commandArgs []string) []*model.Command { - commands := make([]*model.Command, 0, len(commandArgs)) - - for _, commandArg := range commandArgs { - command := getCommandFromCommandArg(a, commandArg) - commands = append(commands, command) - } - - return commands -} - -func parseCommandArg(commandArg string) (string, string) { - result := strings.SplitN(commandArg, COMMAND_ARGS_SEPARATOR, 2) - - if len(result) == 1 { - return "", commandArg - } - - return result[0], result[1] -} - -func getCommandFromCommandArg(a *app.App, commandArg string) *model.Command { - teamArg, commandPart := parseCommandArg(commandArg) - if teamArg == "" && commandPart == "" { - return nil - } - - var command *model.Command - if teamArg != "" { - team := getTeamFromTeamArg(a, teamArg) - if team == nil { - return nil - } - - if result := <-a.Srv.Store.Command().GetByTrigger(team.Id, commandPart); result.Err == nil { - command = result.Data.(*model.Command) - } else { - fmt.Println(result.Err.Error()) - } - } - - if command == nil { - if result := <-a.Srv.Store.Command().Get(commandPart); result.Err == nil { - command = result.Data.(*model.Command) - } - } - - return command -} |