Skip to content

Commit

Permalink
Hide flags on leaf commands (#3492)
Browse files Browse the repository at this point in the history
Without visiting every child, the flags were not hidden on "leaf" commands.
  • Loading branch information
justinsb authored Aug 25, 2022
1 parent d8b7704 commit 171d36b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,9 @@ func hideFlags(cmd *cobra.Command) {
for _, f := range flags {
_ = cmd.PersistentFlags().MarkHidden(f)
}

// We need to recurse into subcommands otherwise flags aren't hidden on leaf commands
for _, child := range cmd.Commands() {
hideFlags(child)
}
}

0 comments on commit 171d36b

Please sign in to comment.