-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
parseArgs with type: "boolean" and default: true does not allow a false value #53095
Comments
I see many node configuration use this bidirectional flag format, I'm willing to implement it in |
The bidirectional flag format is really common here because it allows to change the default of the flag in a follow-up major. |
This can be done using the tokens array, though it does require about a dozen lines of boilerplate. |
In fact, the same example of adding support for negation from the parseArgs repo (linked above) is also used as the example use of tokens in the Node.js documentation: |
PR-URL: #53107 Refs: #53095 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]>
PR-URL: #53107 Refs: #53095 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]>
PR-URL: nodejs#53107 Refs: nodejs#53095 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]>
PR-URL: nodejs#53107 Refs: nodejs#53095 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]>
Fixed by #53107, presumably? |
I believe that was the intent, so I've closed this |
PR-URL: #53107 Refs: #53095 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]>
PR-URL: #53107 Refs: #53095 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]>
Consider the following example:
How can somebody add a flag that can be defaulted as
true
, but allow a--no
flag to set it to false? I imagine that atype: "boolean"
setting would add both--flag
and--no-flag
.The text was updated successfully, but these errors were encountered: