diff options
| author | Alex Flint <[email protected]> | 2024-06-30 10:31:00 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-06-30 10:31:00 -0400 |
| commit | 177b84441e5eb5667ef51f93bbd8e34eecc5c0a8 (patch) | |
| tree | e6277a9c3ab651484c233da699fa90874fcdf3ee /usage.go | |
| parent | bee5cf5d7cc07c41b2a528052bfba0566b5069c0 (diff) | |
| parent | a7c40c36a3a425dd1d28cbc97a3340aafb494d19 (diff) | |
Merge pull request #256 from hhromic/fix-246
Use standard exit status code for usage errors
Diffstat (limited to 'usage.go')
| -rw-r--r-- | usage.go | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -9,13 +9,13 @@ import ( // the width of the left column const colWidth = 25 -// Fail prints usage information to stderr and exits with non-zero status +// Fail prints usage information to p.Config.Out and exits with status code 2. func (p *Parser) Fail(msg string) { p.FailSubcommand(msg) } -// FailSubcommand prints usage information for a specified subcommand to stderr, -// then exits with non-zero status. To write usage information for a top-level +// FailSubcommand prints usage information for a specified subcommand to p.Config.Out, +// then exits with status code 2. To write usage information for a top-level // subcommand, provide just the name of that subcommand. To write usage // information for a subcommand that is nested under another subcommand, provide // a sequence of subcommand names starting with the top-level subcommand and so @@ -27,7 +27,7 @@ func (p *Parser) FailSubcommand(msg string, subcommand ...string) error { } fmt.Fprintln(p.config.Out, "error:", msg) - p.config.Exit(-1) + p.config.Exit(2) return nil } |
