-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Additional help topic commands now return "subcommand is required" error #1056
Comments
At first glance, I'm in agreement with refining the change to not consider an additional help topic commands an error. It would help to see some examples and their expected behavior. |
Hi @bruceadowns, thanks and sorry for the delayed reply. A concrete example would be the This command doesn't define a
After upgrading to cobra 0.0.6, a
Does that make sense? I can provide a minimal self-contained example project if you'd prefer. If you agree that it makes sense, should I open a PR with the patch I proposed in the first comment, or would you have a more involved solution in mind? |
That makes perfect sense, thanks for the clarification. I'd recommend opening a PR, using your proposed solution, with any relatable tests. |
Issue Reference: spf13#1056 when a command was not runnable. This caused all commands w/o a run function set to error w/ that message and a status code of 1. This change reverts the addition of that new error. Similar functionality can be accomplished by leveraging RunE.
Issue Reference: spf13#1056 spf13#922 introduced a new error type that emitted when a command was not runnable. This caused all commands w/o a run function set to error w/ that message and a status code of 1. This change reverts the addition of that new error. Similar functionality can be accomplished by leveraging RunE.
Issue Reference: #1056 #922 introduced a new error type that emitted when a command was not runnable. This caused all commands w/o a run function set to error w/ that message and a status code of 1. This change reverts the addition of that new error. Similar functionality can be accomplished by leveraging RunE.
Issue Reference: spf13/cobra#1056 spf13/cobra#922 introduced a new error type that emitted when a command was not runnable. This caused all commands w/o a run function set to error w/ that message and a status code of 1. This change reverts the addition of that new error. Similar functionality can be accomplished by leveraging RunE.
Issue Reference: spf13/cobra#1056 spf13/cobra#922 introduced a new error type that emitted when a command was not runnable. This caused all commands w/o a run function set to error w/ that message and a status code of 1. This change reverts the addition of that new error. Similar functionality can be accomplished by leveraging RunE.
#922 changed the behavior of all non-runnable commands, including additional help topic commands.
They now return the new
ErrSubCommandRequired
error, which by default results insubcommand is required
being displayed and exiting with status 1. Both are incorrect for additional help topic commands, whose entire purpose is to display a help message.Can we restore the previous behavior for additional help topic commands? Naively, something like this:
cc @bruceadowns
The text was updated successfully, but these errors were encountered: