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
Negative options #460
Negative options #460
Conversation
+1 An option's default must match its type error in master |
@@ -86,7 +86,7 @@ def usage(padding = 0) | |||
sample = "[#{sample}]" unless required? | |||
|
|||
if boolean? | |||
sample << ", [#{dasherize("no-" + human_name)}]" unless name == "force" | |||
sample << ", [#{dasherize("no-" + human_name)}]" unless name == "force" or name.start_with?("no") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this line would prevent the automatic negation of all options that that start with "no"
, even if they are not negative options?
For example, what if there was an boolean --nougat
option. I believe this would prevent the generation of a --no-nougat
option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I fixed it and also added a test case for "--nougat" to make sure there will never be a regression :)
…boolean options (--no-foo)
Thanks! |
Because: * rails#460 (released in `0.19.2`) introduced a change that prevents double negative options (`--no-no-foo`) for already negative boolean options (`--no-foo`). * That change checks if the option name string starts with 'no-', before it's `dasherized`, therefore negative options defined with underscores (`:no_foo`) still generate a double negative `--no-no-foo` option.
Because: * rails#460 (released in `0.19.2`) introduced a change that prevents double negative options (`--no-no-foo`) for already negative boolean options (`--no-foo`). * That change checks if the option name string starts with 'no-', before it's `dasherized`, therefore negative options defined with underscores (`:no_foo`) still generate a double negative `--no-no-foo` option. This change: * Adds a test for, and fixes the double negative boolean options defined with underscores.
Do not generate a negative option (--no-no-foo) for already negative boolean options (--no-foo)