Skip to content

fix(completion): don't show positional args choices with option choices#2148

Merged
bcoe merged 2 commits intoyargs:mainfrom
alan-agius4:positional-completions
Mar 23, 2022
Merged

fix(completion): don't show positional args choices with option choices#2148
bcoe merged 2 commits intoyargs:mainfrom
alan-agius4:positional-completions

Conversation

@alan-agius4
Copy link
Contributor

Previously, when both positional arguments and options has choices, during autocompletion we displayed both at the same time.

this.yargs.getInternalMethods().getContext().commands.length +
/* name of the script is first param */ 1
);
const positionalValues = argv._.slice(offset);
Copy link
Contributor Author

@alan-agius4 alan-agius4 Mar 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed since this is a redundant slice.

Previously, when both positional arguments and options has choices, during autocompletion we displayed both at the same time.
@alan-agius4 alan-agius4 force-pushed the positional-completions branch from db14a29 to bab0f79 Compare March 21, 2022 15:04
This is similar to the code in `completeOptionKey`
@alan-agius4 alan-agius4 force-pushed the positional-completions branch from bab0f79 to 904772c Compare March 21, 2022 15:05
@bcoe bcoe merged commit b58b5bc into yargs:main Mar 23, 2022
@bcoe
Copy link
Member

bcoe commented Mar 23, 2022

@alan-agius4 thank you for the patch.

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.

2 participants