mirror of
https://github.com/status-im/consul.git
synced 2025-02-16 15:47:21 +00:00
Add base command option for hiding generated help for normal args
This commit is contained in:
parent
a2997e2823
commit
8b31eef467
@ -33,6 +33,8 @@ type BaseCommand struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
Flags FlagSetFlags
|
Flags FlagSetFlags
|
||||||
|
|
||||||
|
HideNormalFlagsHelp bool
|
||||||
|
|
||||||
flagSet *flag.FlagSet
|
flagSet *flag.FlagSet
|
||||||
hidden *flag.FlagSet
|
hidden *flag.FlagSet
|
||||||
|
|
||||||
@ -233,6 +235,7 @@ func (c *BaseCommand) helpFlagsFor(f *flag.FlagSet) string {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !c.HideNormalFlagsHelp {
|
||||||
firstCommand := true
|
firstCommand := true
|
||||||
f.VisitAll(func(f *flag.Flag) {
|
f.VisitAll(func(f *flag.Flag) {
|
||||||
// Skip HTTP flags as they will be grouped separately
|
// Skip HTTP flags as they will be grouped separately
|
||||||
@ -245,6 +248,7 @@ func (c *BaseCommand) helpFlagsFor(f *flag.FlagSet) string {
|
|||||||
}
|
}
|
||||||
printFlag(&out, f)
|
printFlag(&out, f)
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return strings.TrimRight(out.String(), "\n")
|
return strings.TrimRight(out.String(), "\n")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user