-
Notifications
You must be signed in to change notification settings - Fork 10
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
How might I add support for defaults? (And env?) #82
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
I guess I was missing something 🤦 I did get this to work. Thanks for the help. It would still be nice to add support for defaults as well as required options in the future. |
I'm not particularly fond of coupling environment variables into parsed arguments but I do like the idea of default values, as well as indicating whether the default value has been assigned or not. |
Rolling your own support for just defaults is a one-liner. Per #142 (comment)
|
Node.js v18.11.0 includes support for defaults. Closing this stale example of bring-your-own-code. |
(This is a bring-your-own-feature experiment, not a prototype of parseArgs implementation.)
Default values is our current canonical example of something that might get added in the future. A complication for some uses of defaults is telling whether the option value came from the user or the defaults. Another feature is support for options coming from environment variables.
Can we add all three of those in user land now?
The text was updated successfully, but these errors were encountered: