From 59b84fcda3b42d833e2ddab4a21b6f549d8692d5 Mon Sep 17 00:00:00 2001 From: Frank Schroeder Date: Thu, 5 Oct 2017 17:19:25 +0200 Subject: [PATCH] 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 #3536 --- vendor/github.com/mitchellh/cli/cli.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vendor/github.com/mitchellh/cli/cli.go b/vendor/github.com/mitchellh/cli/cli.go index 651a0b283e..a95a02ffca 100644 --- a/vendor/github.com/mitchellh/cli/cli.go +++ b/vendor/github.com/mitchellh/cli/cli.go @@ -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)