-
-
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
Long command descriptions #1291
Comments
Nice description of your problem and some potential solutions, thanks. There is support for added text after the built-in help using an event listener. This is the best solution currently available. https://github.com/tj/commander.js#custom-help |
I am working on a big refactor of the help formatting in #1365. It includes a hook for the subcommand description, so would allow (say) only displaying the first line of the description: program.configureHelp({
commandDescription: (cmd) => {
return cmd.description.split('\n', 1)[0];
});
}); |
Enhanced support for customised help has shipped in Commander 7.0.0, although not separate command summary and description as suggested here. This issue has not had any activity in over six months. It isn't likely to get acted on due to this report. Feel free to open a new issue if it comes up again, with new information and renewed interest. Thank you for your contributions. |
Opened a PR to add |
I'm in a situation where I need less technical people to use my code. A CLI works great for me here, but I think it would be good to add a bunch of documentation to it.
Which leads me to what looks to be a limitation of the current
commander
. I want the help text to do something like this:Expected
Current
When I simply add all the text to
.description()
it will also render the full text in> my-app --help
. This makes it very hard to read.Potential solutions
Overwrite help
In #1225 you mention splitting up the help command in header, body, and footer. Using that I can overwrite
--help
and insert more text into it. Though I believe overwriting help like this might lead to some stuff not working properly anymore?Summary method
Another solution is to introduce another method. For example:
Limit description
The final solution I can think of is to remove all line-breaks and limit the number of characters when showing the description in the commands section. You can also try and make this a bit nicer by only showing everything before the first
.
or something like that.results in:
The text was updated successfully, but these errors were encountered: