diff options
author | Jesús Espino <jespinog@gmail.com> | 2018-07-24 16:11:47 +0200 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2018-07-24 10:11:47 -0400 |
commit | bfb2640451c95b242ae7b8bb8528538b706412ef (patch) | |
tree | 0287dc30c4fa70a3c457371dfd5cfd1a7d91376f /cmd/mattermost/commands/import.go | |
parent | da124f018dbb10a41f4d4b5ecb4818baf628e940 (diff) | |
download | chat-bfb2640451c95b242ae7b8bb8528538b706412ef.tar.gz chat-bfb2640451c95b242ae7b8bb8528538b706412ef.tar.bz2 chat-bfb2640451c95b242ae7b8bb8528538b706412ef.zip |
Add idiomatic error handling in mattermost commands (#9147)
Diffstat (limited to 'cmd/mattermost/commands/import.go')
-rw-r--r-- | cmd/mattermost/commands/import.go | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/cmd/mattermost/commands/import.go b/cmd/mattermost/commands/import.go index 8526ba6f8..d376fd61e 100644 --- a/cmd/mattermost/commands/import.go +++ b/cmd/mattermost/commands/import.go @@ -125,7 +125,9 @@ func bulkImportCmdF(command *cobra.Command, args []string) error { if apply && validate { CommandPrettyPrintln("Use only one of --apply or --validate.") return nil - } else if apply && !validate { + } + + if apply && !validate { CommandPrettyPrintln("Running Bulk Import. This may take a long time.") } else { CommandPrettyPrintln("Running Bulk Import Data Validation.") @@ -141,12 +143,12 @@ func bulkImportCmdF(command *cobra.Command, args []string) error { CommandPrettyPrintln(fmt.Sprintf("Error occurred on data file line %v", lineNumber)) } return err + } + + if apply { + CommandPrettyPrintln("Finished Bulk Import.") } else { - if apply { - CommandPrettyPrintln("Finished Bulk Import.") - } else { - CommandPrettyPrintln("Validation complete. You can now perform the import by rerunning this command with the --apply flag.") - } + CommandPrettyPrintln("Validation complete. You can now perform the import by rerunning this command with the --apply flag.") } return nil |