From 627e625b415aa93b69da2e33eedc28889660ac08 Mon Sep 17 00:00:00 2001 From: Rogger Vasquez Date: Fri, 5 Aug 2022 11:20:46 -0500 Subject: [PATCH] rpk: deprecate child commands of deprecated cmds 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. --- src/go/rpk/pkg/cli/cmd/common/common.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/go/rpk/pkg/cli/cmd/common/common.go b/src/go/rpk/pkg/cli/cmd/common/common.go index a44701a1e1ce..6c1cbf7964cd 100644 --- a/src/go/rpk/pkg/cli/cmd/common/common.go +++ b/src/go/rpk/pkg/cli/cmd/common/common.go @@ -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 }