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: requiresArg should only be enforced if argument exists #1043

Merged
merged 2 commits into from Jan 15, 2018
Merged

Conversation

bcoe
Copy link
Member

@bcoe bcoe commented Jan 11, 2018

const value = argv[key]
// if the argument is not set in argv no need to check
// whether a right-hand-side has been provided.
if (Object.keys(argv).indexOf(key) === -1) return
Copy link

Choose a reason for hiding this comment

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

Why not argv.hasOwnProperty(key)?

Copy link
Member Author

Choose a reason for hiding this comment

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

@jddxf no good reason, will update the code accordingly.

@bcoe bcoe merged commit fbf41ae into master Jan 15, 2018
@bcoe bcoe deleted the fix-1041 branch January 15, 2018 19:32
@evocateur
Copy link
Contributor

Eagerly awaiting this, got bit by it trying to upgrade lerna from yargs 8.x

@bcoe
Copy link
Member Author

bcoe commented Jan 17, 2018

@evocateur mind taking yargs@next for a spin, this should correct the issue; apologies for the regression.

@evocateur
Copy link
Contributor

evocateur commented Jan 17, 2018 via email

@evocateur
Copy link
Contributor

@bcoe No joy, pretty sure #1015 was incorrect in adding undefined to the defaultValues check. I'm hacking locally, will open a PR if I find a solution.

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.

requiresArg is enforced when option is not passed
3 participants