-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Customize help message for a command #1023
Comments
lol great post! #1111111111(2) |
I'll try and explain what is happening with what you tried.
This adds an option which effectively overrides the built-in help since it uses the same flags. The callback is used for "Custom option processing" and covered in the README. Flags are treated as "global" and these three calls get processed much the same way and call your action handler:
This approach would let you customise the help for your main command, but you do miss out on the built-in support for help on the subcommands. |
Related issue, prefix help with some text: #578 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Currently there is a single event which is emitted after the help is displayed, A possible approach for allowing more control might be to emit three events:
If there is a listener for |
This issue has not had any activity in over six months. It isn't likely to get acted on due to this report. I quite like the Feel free to open a new issue if it comes up again, with new information and renewed interest. Thank you for your contributions. |
Can anyone give me example usage of |
The |
Ok. Sorry. |
Our goal: customize the help message for the root command.
Existing solution won't help, because we need to append the message on top of auto-gen help, and also modify the auto-gen help a little bit.
Context for our cmd app: below is the root cmd, and we have a
sub-cmd
under the root as well as agit-style-sub-command
.In the example I tried using option('-h, --help'), the console.log works for me with my demanded help output. But when I try sub-cmd and git-style-sub-cmd, the help message for the root command is always coming along when I type "cmd sub-cmd --help" and "cmd git-style-sub-cmd --help".
I noticed #242 , where @shadowspawn mentioned it won't be supported. Reopen it as it'd be an important feature for us.
The text was updated successfully, but these errors were encountered: