forked from choria-io/asyncjobs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request choria-io#101 from ripienaar/100
(choria-io#100) improve usage output
- Loading branch information
Showing
1 changed file
with
4 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,8 @@ func main() { | |
ajc.Version(version) | ||
ajc.Author("R.I.Pienaar <[email protected]>") | ||
ajc.UsageWriter(os.Stdout) | ||
ajc.UsageTemplate(fisk.CompactUsageTemplate) | ||
ajc.UsageTemplate(fisk.CompactMainUsageTemplate) | ||
ajc.ErrorUsageTemplate(fisk.CompactMainUsageTemplate) | ||
ajc.HelpFlag.Short('h') | ||
|
||
ajc.Flag("context", "NATS Context to use for connecting to JetStream").PlaceHolder("NAME").Envar("CONTEXT").Default("AJC").StringVar(&nctx) | ||
|
@@ -46,9 +47,6 @@ func main() { | |
_, err := ajc.Parse(os.Args[1:]) | ||
if err != nil { | ||
switch { | ||
case strings.Contains(err.Error(), "expected command but"): | ||
ajc.Usage(nil) | ||
|
||
case strings.Contains(err.Error(), "unknown context"): | ||
fmt.Fprintf(os.Stderr, "ajc: no NATS context %q found, create one using 'nats context'\n", nctx) | ||
|
||
|
@@ -60,6 +58,8 @@ func main() { | |
|
||
default: | ||
fmt.Fprintf(os.Stderr, "ajc runtime error: %v\n", err) | ||
fmt.Fprintln(os.Stderr) | ||
ajc.Usage(os.Args[1:]) | ||
} | ||
|
||
os.Exit(1) | ||
|