Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
more changes
Browse files Browse the repository at this point in the history
Signed-off-by: Yuvraj <[email protected]>
  • Loading branch information
yindia committed Jul 26, 2021
1 parent fff86de commit 0eeb45d
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,7 @@ func (r *RootOptions) initConfig(cmd *cobra.Command, _ []string) error {
})

// persistent flags were initially bound to the root command so we must bind to the same command to avoid
// overriding those initial ones. We need to traverse up to the root command and initialize pflags for that.
rootCmd := cmd
for rootCmd.Parent() != nil {
rootCmd = rootCmd.Parent()
}

r.configAccessor.InitializePflags(rootCmd.PersistentFlags())
r.configAccessor.InitializePflags(cmd.PersistentFlags())

err := r.configAccessor.UpdateConfig(context.TODO())
if err != nil {
Expand Down

0 comments on commit 0eeb45d

Please sign in to comment.