mirror of https://github.com/status-im/consul.git
command: drop hidden flags from base command
This commit is contained in:
parent
bc78fa576a
commit
a364555121
|
@ -36,7 +36,6 @@ type BaseCommand struct {
|
|||
HideNormalFlagsHelp bool
|
||||
|
||||
flagSet *flag.FlagSet
|
||||
hidden *flag.FlagSet
|
||||
|
||||
// These are the options which correspond to the HTTP API options
|
||||
httpAddr configutil.StringValue
|
||||
|
@ -172,18 +171,10 @@ func (c *BaseCommand) NewFlagSet(command cli.Command) *flag.FlagSet {
|
|||
f.SetOutput(errW)
|
||||
|
||||
c.flagSet = f
|
||||
c.hidden = flag.NewFlagSet("", flag.ContinueOnError)
|
||||
|
||||
return f
|
||||
}
|
||||
|
||||
// HideFlags is used to set hidden flags that will not be shown in help text
|
||||
func (c *BaseCommand) HideFlags(flags ...string) {
|
||||
for _, f := range flags {
|
||||
c.hidden.String(f, "", "")
|
||||
}
|
||||
}
|
||||
|
||||
// Parse is used to parse the underlying flag set.
|
||||
func (c *BaseCommand) Parse(args []string) error {
|
||||
return c.flagSet.Parse(args)
|
||||
|
@ -243,7 +234,7 @@ func (c *BaseCommand) helpFlagsFor(f *flag.FlagSet) string {
|
|||
firstCommand := true
|
||||
f.VisitAll(func(f *flag.Flag) {
|
||||
// Skip HTTP flags as they will be grouped separately
|
||||
if flagContains(httpFlagsClient, f) || flagContains(httpFlagsServer, f) || flagContains(c.hidden, f) {
|
||||
if flagContains(httpFlagsClient, f) || flagContains(httpFlagsServer, f) {
|
||||
return
|
||||
}
|
||||
if firstCommand {
|
||||
|
|
Loading…
Reference in New Issue