remove flags.Parse in cobra

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero
2022-09-18 13:25:54 +08:00
committed by yxxhero
parent 8408b021f0
commit 24cefc7fd5
2 changed files with 1 additions and 9 deletions
-8
View File
@@ -68,16 +68,8 @@ func NewRootCmd(globalConfig *config.GlobalOptions, args []string) (*cobra.Comma
// Set the global options for the root command.
setGlobalOptionsForRootCmd(flags, globalConfig)
// 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
err := flags.Parse(args)
if err != nil {
return nil, err
}
globalImpl := config.NewGlobalImpl(globalConfig)
cmd.AddCommand(
NewApplyCmd(globalImpl),