Fix a parsing issue with command line arguments

Prior to now, helm has been silently ignoring any errors while parsing
the root Persistent flags. This causes an issue when a global flag comes
later on the command line than a localized flag for a subcommand, in
which the value for that global flag is never set. The solution is to
simply tell the Persistent flagset to ignore any unknown flags, since a
later command will process it

Signed-off-by: Ian Howell <ian.howell0@gmail.com>
pull/6076/head
Ian Howell 5 years ago
parent 63d7a0c2cf
commit 4646b22328

@ -119,6 +119,11 @@ func newRootCmd(actionConfig *action.Configuration, out io.Writer, args []string
settings.AddFlags(flags)
// We can safely ignore any errors that flags.Parse encounters since
// those errors will be caught later during the call to cmd.Execution.
// This call is required to gather configuration information prior to
// execution.
flags.ParseErrorsWhitelist.UnknownFlags = true
flags.Parse(args)
// set defaults from environment

Loading…
Cancel
Save