Skip to content
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

multiple: improved completion for choices #2083

Merged
merged 2 commits into from Dec 29, 2021

Conversation

gmahomarf
Copy link
Contributor

This is an improvement on #2018. Changes:

  • Improvement: Completion for choices will now work for all possible aliases of an option and not just the default long option. This is accomplished by iterating over all known aliases of the provided option, and checking for choices on each.
  • Fix: changed the RegExp used to remove hypens (-), because it removed ALL hyphens from the argument, which broke options like --long-option-with-dashes. It now only removes dashes at the beginning of the option.
  • Fix: changed the check for option arguments to match options that begin with '-', instead of '--', to include short options

Completion for choices will now work for all possible aliases of an
option and not just the default long option.
@bcoe
Copy link
Member

bcoe commented Dec 21, 2021

@gmahomarf thank you for the patch, and appologies for slow review, will work on getting a release of yargs out over the holiday break hopefully.

@bcoe bcoe changed the title Improved completion for choices multiple: improved completion for choices Dec 29, 2021
@bcoe bcoe merged commit 30edd50 into yargs:main Dec 29, 2021
@bcoe
Copy link
Member

bcoe commented Dec 29, 2021

@gmahomarf thank you for the contribution 👏

@gmahomarf gmahomarf deleted the choices-completion-improvements branch January 7, 2022 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants