-
-
Notifications
You must be signed in to change notification settings - Fork 151
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
Do not define unset boolean args #77
Conversation
Does Yargs also default to |
Yards default to |
I'm still a little bit unsure whether |
OK, we can have an option. We just need to define what's the default.
|
This. I've only needed unset options in XO and one other CLI before. |
Even when |
That's already the case in the current PR. So we can add the option |
Yes! Much better than what I had in mind. |
I added the |
Updated to to yargs-parser@10.0.0 |
Looks good. Thanks, @pvdlg :) |
- this was introduced in sindresorhus#77, likely due to compatibility with minimist - `booleanDefault: null` causes minimist-options to error - even in 2019, this was a confusing type: sindresorhus#116 (comment)
* this was introduced in sindresorhus#77, likely due to compatibility with minimist * `booleanDefault: null` causes minimist-options to error * even in 2019, this was a confusing type: sindresorhus#116 (comment)
* this was introduced in sindresorhus#77, likely due to compatibility with minimist * `booleanDefault: null` causes minimist-options to error * even in 2019, this was a confusing type: sindresorhus#116 (comment)
Proposal to solve xojs/xo#299.
For each boolean arg that doesn't define a
default
, set it toundefined
. After parsing remove the options with a value ofundefined
.Unfortunately this doesn't work with
minimist
due to an unrelated bug when using bothdefault
andalias
:I replaced
minimist
with yargs-parser to solve this issue.meow
relies on minimist-options to transform the options format. It still works withyargs-parser
as the format is the same.This PR works as a fix for xojs/xo#299 but it might be a desireable to support the other yargs-parser options. That would require to support those option in
minimist-options
or to replace it.Not sure if it worth the effort though, as yargs already allow all those options and support the same convenient format as
meow
via the options function: