Skip to content

Commit 5e880f6

Browse files
authored
Merge pull request #18725 from vbotbuildovich/backport-pr-18723-v24.1.x-774
[v24.1.x] rpk: explicitly add Arg validation to plugins
2 parents 1a0b1ac + cbe1c4d commit 5e880f6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/go/rpk/pkg/cli/plugin_cmds.go

+2
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ func addPluginWithExec(
8888
Use: p0,
8989
Short: p0 + pluginShortSuffix,
9090
DisableFlagParsing: true,
91+
Args: cobra.MinimumNArgs(0),
9192
Run: func(cmd *cobra.Command, args []string) {
9293
keepForPlugin, _ := cobraext.StripFlagset(args, cmd.InheritedFlags()) // strip all rpk specific flags before execing the plugin
9394
err := osExec(execPath, keepForPlugin)
@@ -263,6 +264,7 @@ func addPluginSubcommands(
263264
childCmd := &cobra.Command{
264265
Short: fmt.Sprintf("%s external plugin", childUse),
265266
DisableFlagParsing: true,
267+
Args: cobra.MinimumNArgs(0),
266268
Run: func(cmd *cobra.Command, args []string) {
267269
keepForPlugin, _ := cobraext.StripFlagset(args, cmd.InheritedFlags()) // strip all rpk specific flags before execing the plugin
268270
osExec(execPath, append(append(leadingPieces, cmd.Use), keepForPlugin...))

0 commit comments

Comments
 (0)