Skip to content

Commit

Permalink
Merge pull request #18723 from r-vasquez/patch-no-arg-plugin
Browse files Browse the repository at this point in the history
rpk: explicitly add Arg validation to plugins
  • Loading branch information
twmb authored May 30, 2024
2 parents 849f50a + 0c9a20b commit 2b3ee2e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/go/rpk/pkg/cli/plugin_cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func addPluginWithExec(
Use: p0,
Short: p0 + pluginShortSuffix,
DisableFlagParsing: true,
Args: cobra.MinimumNArgs(0),
Run: func(cmd *cobra.Command, args []string) {
keepForPlugin, _ := cobraext.StripFlagset(args, cmd.InheritedFlags()) // strip all rpk specific flags before execing the plugin
err := osExec(execPath, keepForPlugin)
Expand Down Expand Up @@ -263,6 +264,7 @@ func addPluginSubcommands(
childCmd := &cobra.Command{
Short: fmt.Sprintf("%s external plugin", childUse),
DisableFlagParsing: true,
Args: cobra.MinimumNArgs(0),
Run: func(cmd *cobra.Command, args []string) {
keepForPlugin, _ := cobraext.StripFlagset(args, cmd.InheritedFlags()) // strip all rpk specific flags before execing the plugin
osExec(execPath, append(append(leadingPieces, cmd.Use), keepForPlugin...))
Expand Down

0 comments on commit 2b3ee2e

Please sign in to comment.