From e23cbe43eaf6e2d13aa8c976bb93e95b856da842 Mon Sep 17 00:00:00 2001 From: Adrian Orive Date: Wed, 17 Feb 2021 09:32:00 +0100 Subject: [PATCH] Fix the bug where an error was being hidden by a potentially valid flag not being recognized by the root command Signed-off-by: Adrian Orive --- pkg/cli/root.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/cli/root.go b/pkg/cli/root.go index d0eed81e44b..e0baa398180 100644 --- a/pkg/cli/root.go +++ b/pkg/cli/root.go @@ -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 }