Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpk: subcommands does not return "unknown command" error #18627

Closed
r-vasquez opened this issue May 22, 2024 · 0 comments · Fixed by #18650
Closed

rpk: subcommands does not return "unknown command" error #18627

r-vasquez opened this issue May 22, 2024 · 0 comments · Fixed by #18650
Labels
good first issue Good for newcomers kind/bug Something isn't working

Comments

@r-vasquez
Copy link
Contributor

r-vasquez commented May 22, 2024

Version & Environment

Redpanda version: (use rpk version): v24.1.2

What went wrong?

When running an unknown subcommand of an rpk subcommand, rpk won't return an "unknown command" error and exit with an error code 0:

$ rpk cluster foobar
Interact with a Redpanda cluster

Usage:
  rpk cluster [flags]
  rpk cluster [command]

Available Commands:
  config      Interact with cluster configuration properties
  [...]

Use "rpk cluster [command] --help" for more information about a command.

$ echo $?
0

What should have happened instead?

To return 1, and an error:

Error: unknown command "foobar" for "rpk cluster"

How to reproduce the issue?

  1. Steps above.

Additional information

This is a known behavior in Cobra: spf13/cobra#706 the fix is to add a Cobra.NoArg to every subcommand with child commands.

JIRA Link: CORE-3065

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant