-
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
required
option
#150
Comments
I think we should define the following:
I would like to share this interesting discussion from the JSON Schema spec, that adopted the pattern:
|
See some discussion at nodejs/node#44564 / nodejs/node#44565. Personally I agree with the argument against doing this made in this comment. |
Side note on potential naming confusion. The terms "required" and "optional" also get used to describe whether an option must have an option value. Given these three uses:
A possible name to reduce this confusion is (Edit: for interest, yargs has
That is simple to understand. I took a different approach when implementing required-option functionality myself, in case the author was using the default as simple support for environment variables. This does makes the behaviour of required-option more subtle, it means the option must have a value after parsing, rather than requiring it is specified on command-line.
|
Currently, Node.js is checking that arg has the correct type (by the
strict
option).By I need manually check that this arg was provided by user. How about boolean flag
required
for this?Before:
After:
The text was updated successfully, but these errors were encountered: