-
-
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
Indent multi-line option description in help #759
Comments
It would be great if the help was aware of the terminal width and wrapped lines that overflow intelligently, though I recognize that's a separate feature request. |
Upvoting this, the console's width can be obtained using |
Upvoting this as well, just stumbled into this issue myself. |
A caveat that a previous attempt at indenting multiline descriptions was pulled after it broke user formatted help: #396 |
v4.0.0-0 prerelease published: #1067 |
v4.0.0 has been released. |
The reliance on
May I propose a PR? |
(The output honoring the columns value is nice looking, though). |
Short version: PR welcome, thanks. Long version Standard, like here? For interest, in Commander's own unit tests I set A caveat that there is a fix coming to remove trailing space in wrapped output: #1096 |
Yes. Also mentioned in the bash help.
That only works if testing the API. It doesn't work when the command is spawned. To test my application, I'm using a CLI test framework which doesn't allow me to control how the stdio is configured. So it's out of reach. The same would be true for integrations that spawn the command using commander.js. |
Doing a little research, found one interesting complication that Potentially ok, but if find other platform/shell clashes then could use a custom name for the override like |
I'd honestly be fine with any environment variable name, tbh. In fact, I'd even be happy if it were a method I could override. I just need it for testing / integration, so it can be rather low level. The main issue is that the call is in the middle of several functions and I have no way to get at it so I can influence it. |
I am preferring |
Yep, that would do the trick. I still think it makes sense to extract that bit of logic as a method since it is used a couple of times in the code. It would not only make it overriddable, but also DRY. We'd likely never hear any complaints again ;) At this point, we should probably start a new issue as this one is already closed. Would you like me to do that, or would you prefer to do it. |
Please go ahead and make a new issue. Thanks. Extracting that bit of logic is something I considered at the time, and more logic now and more worthwhile, but I don't want to make it public. The env is the supported override mechanism. |
If the description of an option contains line breaks, subsequent lines should be indented to match the position of the first line in the help output. Otherwise, we see something like this:
The text was updated successfully, but these errors were encountered: