mirror of https://github.com/hashicorp/consul
command: backport patch for mitchellh/cli help flag handling (#3536)
This patch backports a fix which will show the correct usage screen for command line flags. This is considered a temporary fix until the code has been refactored. Newer versions of the cli library require that the flag set is populated when Help() is called or that it is populated within Help() itself. Fixes #3536pull/3543/head
parent
ce0d03c46a
commit
59b84fcda3
|
@ -578,12 +578,6 @@ func (c *CLI) processArgs() {
|
|||
break
|
||||
}
|
||||
|
||||
// Check for help flags.
|
||||
if arg == "-h" || arg == "-help" || arg == "--help" {
|
||||
c.isHelp = true
|
||||
continue
|
||||
}
|
||||
|
||||
// Check for autocomplete flags
|
||||
if c.Autocomplete {
|
||||
if arg == "-"+c.AutocompleteInstall || arg == "--"+c.AutocompleteInstall {
|
||||
|
@ -604,6 +598,12 @@ func (c *CLI) processArgs() {
|
|||
continue
|
||||
}
|
||||
|
||||
// Check for help flags.
|
||||
if arg == "-h" || arg == "-help" || arg == "--help" {
|
||||
c.isHelp = true
|
||||
continue
|
||||
}
|
||||
|
||||
if arg != "" && arg[0] == '-' {
|
||||
// Record the arg...
|
||||
c.topFlags = append(c.topFlags, arg)
|
||||
|
|
Loading…
Reference in New Issue