forked from ogier/pflag
-
Notifications
You must be signed in to change notification settings - Fork 367
Closed
Milestone
Description
Currently when we use -h or --help flag to print help message, it would add additional pflag: help requested to the end of message; or when some other errors occurred, it would print the error message twice (front and end).
It was caused by those codes,
Lines 1144 to 1150 in 2e9d26c
| case ContinueOnError: | |
| return err | |
| case ExitOnError: | |
| fmt.Println(err) | |
| os.Exit(2) | |
| case PanicOnError: | |
| panic(err) |
And in go's official flag package, it would explicitly ignore the ErrHelp error.
switch f.errorHandling {
case ContinueOnError:
return err
case ExitOnError:
if err == ErrHelp {
os.Exit(0)
}
os.Exit(2)
case PanicOnError:
panic(err)
}I don't know if this was some kind of bug, but a little fixes might be better.🤗
bahlo, enuesaa, nickpetrovic and lcheylus
Metadata
Metadata
Assignees
Labels
No labels