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

fix: do not crash completion when having negable options #2322

Merged
merged 1 commit into from Apr 27, 2023

Conversation

alan-agius4
Copy link
Contributor

Current completion crashes when using ZSH and having negable options.

[error] TypeError: Cannot read properties of undefined (reading 'find')
    at D.completeOptionKey (//node_modules/yargs/build/index.cjs:1255:20)
    at //node_modules/yargs/build/index.cjs:1191:37
    at Array.forEach (<anonymous>)
    at D.optionCompletions (//node_modules/yargs/build/index.cjs:1184:26)
    at D.defaultCompletion (//node_modules/yargs/build/index.cjs:1158:12)
    at n (//node_modules/yargs/build/index.cjs:1313:23)
    at D.getCompletion (//node_modules/yargs/build/index.cjs:1314:31)
    at te.[runYargsParserAndExecuteCommands] (//node_modules/yargs/build/index.cjs:3161:27)
    at _.parseAndUpdateUsage (//node_modules/yargs/build/index.cjs:426:8)
    at _.applyBuilderUpdateUsageAndParse (//node_modules/yargs/build/index.cjs:412:17)

package.json Outdated Show resolved Hide resolved
Current completion crashes when using ZSH and having negable options.

```
[error] TypeError: Cannot read properties of undefined (reading 'find')
    at D.completeOptionKey (//node_modules/yargs/build/index.cjs:1255:20)
    at //node_modules/yargs/build/index.cjs:1191:37
    at Array.forEach (<anonymous>)
    at D.optionCompletions (//node_modules/yargs/build/index.cjs:1184:26)
    at D.defaultCompletion (//node_modules/yargs/build/index.cjs:1158:12)
    at n (//node_modules/yargs/build/index.cjs:1313:23)
    at D.getCompletion (//node_modules/yargs/build/index.cjs:1314:31)
    at te.[runYargsParserAndExecuteCommands] (//node_modules/yargs/build/index.cjs:3161:27)
    at _.parseAndUpdateUsage (//node_modules/yargs/build/index.cjs:426:8)
    at _.applyBuilderUpdateUsageAndParse (//node_modules/yargs/build/index.cjs:412:17)
```
Copy link
Member

@bcoe bcoe left a comment

Choose a reason for hiding this comment

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

LGTM thank you for the fix!

@bcoe bcoe merged commit 7f42848 into yargs:main Apr 27, 2023
7 checks passed
@alan-agius4 alan-agius4 deleted the completion-fixes branch April 27, 2023 19:49
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