Skip to content

Commit

Permalink
Merge pull request #2023 from Adirio/fix-hidden-error
Browse files Browse the repository at this point in the history
🐛 Fix the bug where an error was being hidden by a potentially valid flag not being recognized by the root command
  • Loading branch information
k8s-ci-robot committed Feb 17, 2021
2 parents 7adcffd + e23cbe4 commit b46beea
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ func (c cli) newRootCmd() *cobra.Command {
fs.String(projectVersionFlag, "", "project version")
fs.StringSlice(pluginsFlag, nil, "plugin keys of the plugin to initialize the project with")

// As the root command will be used to shot the help message under some error conditions,
// like during plugin resolving, we need to allow unknown flags to prevent parsing errors.
cmd.FParseErrWhitelist = cobra.FParseErrWhitelist{UnknownFlags: true}

return cmd
}

Expand Down

0 comments on commit b46beea

Please sign in to comment.