-
-
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
Add support for multiple aliases #1236
Conversation
This is awesome! |
Changes: added |
I'll leave PR in draft for a few more days for any other feedback. Thanks @kodie and @victornpb and @abetomo |
No further feedback. Moving out of draft. I have deliberately not added to README for now, hopefully anyone who wants the feature will be able to find it easily enough, and the JSDoc and TSDoc cover the support for multiple aliases. |
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.
Awesome!
Included in Commander v5.1 which has been released. |
This is blocking us from upgrading, since we use Wha'ts the best compatible way to solve this. |
Sorry for the clash @viceice See the section in the README about avoiding name clashes, and have a look at |
@shadowspawn Ok, thanks for the info. Works with the suggested changes. |
Pull Request
See #531
Problem
Some people would like to add more than one alias for a command, but not have them all visible in the help.
Solution
Allow adding multiple aliases. Only display the first one in the built-in help, and leave any mention of the rest up to the caller.
This is intended to be backwards compatible. There is a small change from v5.0 behaviour, calling
.alias()
when there is no alias will now returnundefined
instead ofnull
, but seems unlikely to affect much code and can be made fully backwards compatible if necessary.To provide public access to the possibly multiple aliases, added
.aliases()
which works with array rather than string.ChangeLog