Skip to content

Commit 7c651d1

Browse files
authored
Merge pull request #407 from tmc/fix-errhelp
flag: Emulate stdlib behavior and do not print ErrHelp
2 parents 1db553c + fd649b2 commit 7c651d1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

flag.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,9 @@ func (f *FlagSet) Parse(arguments []string) error {
11731173
case ContinueOnError:
11741174
return err
11751175
case ExitOnError:
1176+
if err == ErrHelp {
1177+
os.Exit(0)
1178+
}
11761179
fmt.Fprintln(f.Output(), err)
11771180
os.Exit(2)
11781181
case PanicOnError:

0 commit comments

Comments
 (0)