aboutsummaryrefslogtreecommitdiffstats
path: root/commands/show.go
diff options
context:
space:
mode:
authorSebastien Devaux <sebastien.devaux@laposte.net>2019-01-07 18:56:29 +0100
committerSebastien Devaux <sebastien.devaux@laposte.net>2019-01-07 18:56:29 +0100
commit5850116c0dd49bd42413305e2484beb50cbcc914 (patch)
treee6508027eef8c79bd865a229a471db58ca00eab9 /commands/show.go
parent68cbde492da7911f67e9cce561d4c877ae36bdbf (diff)
downloadgit-bug-5850116c0dd49bd42413305e2484beb50cbcc914.tar.gz
Simplified show commadn error handling.
Exit on first unknown field found in query.
Diffstat (limited to 'commands/show.go')
-rw-r--r--commands/show.go8
1 files changed, 1 insertions, 7 deletions
diff --git a/commands/show.go b/commands/show.go
index bc898241..0b5585f1 100644
--- a/commands/show.go
+++ b/commands/show.go
@@ -83,8 +83,6 @@ func runShowBug(cmd *cobra.Command, args []string) error {
)
}
} else {
- unknownFields:=""
- err:=false
for _, field := range showFieldsQuery {
switch field {
case "author": fmt.Printf("%s ",firstComment.Author.DisplayName())
@@ -98,14 +96,10 @@ func runShowBug(cmd *cobra.Command, args []string) error {
case "status": fmt.Printf("%s ",snapshot.Status)
case "title": fmt.Printf("%s ",snapshot.Title)
default:
- unknownFields+=field+" "
- err=true
+ return fmt.Errorf("\nUnsupported field: %s\n",field)
}
}
fmt.Printf("\n")
- if err {
- return fmt.Errorf("Unsupported fields requested: %s\n",unknownFields)
- }
}
return nil