don't require flags when the help flag is included
This commit is contained in:
parent
6023f370c1
commit
145da3210f
@ -340,6 +340,13 @@ func normalizeFlags(flags []Flag, set *flag.FlagSet) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func checkRequiredFlags(flags []Flag, set *flag.FlagSet) error {
|
func checkRequiredFlags(flags []Flag, set *flag.FlagSet) error {
|
||||||
|
// If the help flag is included then none of the other flags are required.
|
||||||
|
for _, f := range flags {
|
||||||
|
if f.getName() == "help" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
visited := make(map[string]bool)
|
visited := make(map[string]bool)
|
||||||
set.Visit(func(f *flag.Flag) {
|
set.Visit(func(f *flag.Flag) {
|
||||||
visited[f.Name] = true
|
visited[f.Name] = true
|
||||||
|
Loading…
Reference in New Issue
Block a user