Skip to content

Commit

Permalink
rpk: deprecate child commands of deprecated cmds
Browse files Browse the repository at this point in the history
In the past if you deprecated a command using
common.Deprecated(), the only command that will
show the 'deprecate message' will be the parent
command.
  • Loading branch information
r-vasquez committed Aug 5, 2022
1 parent fd54b14 commit 627e625
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/go/rpk/pkg/cli/cmd/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ https://redpanda.com/feedback`
func Deprecated(newCmd *cobra.Command, newUse string) *cobra.Command {
newCmd.Deprecated = fmt.Sprintf("use %q instead", newUse)
newCmd.Hidden = true

if children := newCmd.Commands(); len(children) > 0 {
for _, child := range children {
Deprecated(child, newUse+" "+child.Name())
}
}
return newCmd
}

Expand Down

0 comments on commit 627e625

Please sign in to comment.