-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Defining boolean options via Command#option() defaults to undefined, not false. #574
Comments
Same issue, the document should be more clear about all flags that contains
Confused me a bit when trying to setup a no flag :p |
Tried to clarify this behavior in tests on #795. Please take a look, and feel free to comment! |
I have proposed a large update to options coverages in README in #953 |
I have rewritten the options description in the README, mentioning the default boolean value being undefined, and covering negatable boolen separately (both with examples). Hopefully this should make it clearer what the current behaviour is. |
According to the example http://tj.github.io/commander.js/#Command.prototype.option, when defining an option that does not have a required or optional value, it defaults to
undefined
when it should default tofalse
. However, if it's long hand value contains-no-
, it properly defaults totrue
.The text was updated successfully, but these errors were encountered: