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
feature: show single-char aliases first in help #1403
Comments
I agree with @zypA13510: this would definitely improve readability of yargs help messages. |
yeah, that looks great would happily accept a patch for this. |
I'd take this issue if you don't mind. If you have any additional inputs or hints, please let me know 🙂 |
@LEQADA go for it, happy to have the contribution; feel free to open a work in progress PR, and people can help field questions. |
@bcoe what should we do in case someone passes Should we format it like this?
|
@zypA13510 @mleguen @bcoe what do you think? 🙂 |
@LEQADA can we find any other CLIs we can crib from? I don't love that we waste some horizontal space that could be used for displaying arguments, I do like the consistency of the layout. I have a slight preference for using all the horizontal space, curious what others think. |
As shown by @zypA13510 in his
So I think you should separate aliases with a comma, that way:
|
@bcoe Combined with @zypA13510's idea of reformatting columns in #880, horizontal space loss in no longer an issue. @LEQADA would you mind addressing both issues in your PR? I think most of the questions you could have adressing the current issue would be answered by the suggestions in #880. |
I agree with @mleguen 👍 which matches |
Is anyone currently working on this or #880? If not I might be able to take a look next week. |
@mrmckeb if you're interested in looking at #880, would love the help. With a word of warning that I imagine quite a few folks, including ourselves, have written integration tests against yargs' help output, so we probably want to be relatively conservative in the layout changes we make, perhaps making improvements incrementally. You will most likely want to start digging into cliui to make these improvements. |
Sorry it's been a while. I planned to address #880, but then life got in the way. I'll take a look today and see how far I get. |
Display short switches first in usage, and indent long switches only options. Fix #1403
Display short switches first in usage, and indent long switches only options. Fix #1403
Display short switches first in usage, and indent long switches only options. Fix #1403
Display short switches first in usage, and indent long switches only options. Fix #1403
Display short switches first in usage, and indent long switches only options. Fix #1403
Display short switches first in usage, and indent long switches only options. Fix #1403
Display short switches first in usage, and indent long switches only options. Fix #1403
Display short switches first in usage, and indent long switches only options. Fix #1403
Display short switches first in usage, and indent long switches only options. Fix #1403
Display short switches first in usage, and indent long switches only options. Fix #1403
Update yargs to v16, this will show a better formatted help by showing the single-char flag first (yargs/yargs#1403). BREAKING CHANGE: drop support of node<10 as this is required by yargs.
If you look at the help message of *nix programs, many of them (especially GNU programs) have a format like this:
Examples (click to expand)
Note that single-char aliases are always put first, and any option without a single-char alias is indented to match the
--
of those with a single-char alias.yargs has this:
which is not bad but I think putting the single-char aliases first is better:
The text was updated successfully, but these errors were encountered: