Skip to content

Conversation

@aderouineau
Copy link

Do not generate a negative option (--no-no-foo) for already negative boolean options (--no-foo)

@Fudoshiki
Copy link

+1 An option's default must match its type error in master

Copy link
Contributor

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.

Copy link
Author

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 :)

@coveralls
Copy link

Coverage Status

Coverage remained the same at 91.81% when pulling d65fef7 on aderouineau:negative-bool into 0399bcf on erikhuda:master.

@sferik
Copy link
Contributor

sferik commented Jan 22, 2015

Thanks!

sferik added a commit that referenced this pull request Jan 22, 2015
@sferik sferik merged commit 53b3fc8 into rails:master Jan 22, 2015
tommarshall added a commit to tommarshall/thor that referenced this pull request Mar 7, 2017
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.
tommarshall added a commit to tommarshall/thor that referenced this pull request Mar 7, 2017
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants