add better handing for usage error

This commit is contained in:
Cory Bennett
2017-08-21 22:54:34 -05:00
parent 56b1c9df04
commit b235dcc384
+7 -3
View File
@@ -271,8 +271,12 @@ func main() {
}
panic(jiracli.Exit{Code: 1})
})
_, err := app.Parse(os.Args[1:])
if err != nil {
log.Fatalf("%s", err)
if _, err := app.Parse(os.Args[1:]); err != nil {
ctx, _ := app.ParseContext(os.Args[1:])
if ctx != nil {
app.UsageForContext(ctx)
}
log.Errorf("Invalid Usage: %s", err)
panic(jiracli.Exit{Code: 1})
}
}