You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How might I add support for defaults? (And env?) #82
(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.
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.
Activity
ljharb commentedon Mar 18, 2022
shadowspawn commentedon Mar 18, 2022
ljharb commentedon Mar 18, 2022
shadowspawn commentedon Mar 18, 2022
iansu commentedon May 28, 2022
bakkot commentedon May 28, 2022
shadowspawn commentedon May 29, 2022
iansu commentedon May 29, 2022
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.
lirantal commentedon Aug 12, 2022
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.
shadowspawn commentedon Sep 4, 2022
Rolling your own support for just defaults is a one-liner. Per #142 (comment)
shadowspawn commentedon Oct 15, 2022
Node.js v18.11.0 includes support for defaults. Closing this stale example of bring-your-own-code.