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
Adds sort to command usage help output #1256
Conversation
@trevorlinton the nice thing about not applying sorting, is folks can control the ordering of commands by definition order. my concern with this change is it would break a lot of downstream consumers of yargs, and would need to be a breaking change; and I feel we'd need to then introduce an API method that allowed people to control the sorting of commands (as they'd now always be sorted, and folks might be picky). @boneskull any opinion? |
can I add it as an optional config (disabled by default?) the particular issue I'm under is I don't have control with the timing when new commands are registered, so the ordering can at times be random. |
@trevorlinton that's an interesting requirement; I'd be open to this, I've been chatting with @cspotcode about adding the ability to configure compiler settings with a flag like FYI, I think you can use |
…breaks test suite) This reverts commit 41fe766.
@trevorlinton see #1262, I'm comfortable with |
…o sort-command-usage
@evocateur @bcoe I added in the |
…space. please squash this merge.
@trevorlinton I'll get #1262 landed ASAP, and then you can rebase against |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM pending rebase
@trevorlinton thanks for your patience, if you don't mind rebasing I'll give this a final review 👍 one note, we'll want to make sure we document the new |
…breaks test suite) This reverts commit 41fe766.
@bcoe I've rebased on master, you can review the file changes, it may be prudent to squash this merge considering all of the conflicts/rebasing that occurred by merging in a unmerged PR and diverging. I've added some notes in api.md on the config option, but I'm not sure how we should document this properly, I'm hoping what's there is good enough or now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great 👍 just a few minor requests for edits.
Thank you for taking this work on.
docs/api.md
Outdated
@@ -1151,8 +1151,13 @@ for details of this object | |||
|
|||
<a name="parserConfiguration"></a>.parserConfiguration(obj) | |||
------------ | |||
`parserConfiguration()` allows you to configure yargs. See [yargs-parser's configuration](https://github.com/yargs/yargs-parser#configuration) for | |||
settings specific to `yargs-parser`. | |||
`parserConfiguration()` allows you to configure yargs-parser. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's make this:
"parserConfiguration()
allows you to configure advanced yargs features:"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
docs/api.md
Outdated
settings specific to `yargs-parser`. | ||
`parserConfiguration()` allows you to configure yargs-parser. | ||
|
||
An object of options should be passed in. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's change this to:
obj
accepts the following configuration options:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
@bcoe I've made the changes to the docs requested. |
@trevorlinton 👍 thank you; I'm excited that we now have a way to configure edge-case output options for folks (just like we do with the parser). |
@trevorlinton please try:
and let me know if it does the trick for you. |
this is now available in |
When showing the usage (if no command is available) the order of commands isn't sorted, this might be a undesirable and could be put into a config setting, but I'd like to see the tolerance to default to sorted rather than as-defined.