darker icon indicating copy to clipboard operation
darker copied to clipboard

Make boolean configuration options overridable

Open akaihola opened this issue 3 years ago • 1 comments

Currently if a boolean option is toggled on in pyproject.toml, there's no way to toggle it off on the command line. To fix this, the following options should be introduced:

  • [ ] --no-stdout
  • [ ] --no-isort
  • [ ] updated help texts
  • [ ] unit tests

Design decisions needed:

  • [ ] option to do neither --diff nor --check?
  • [ ] --no-lint <LINTER> (maybe?)
  • [ ] --no-skip-magic-trailing-comma (or: --magic-trailing-comma?)

See also:

  • many-formatters sub-project
  • discussion in #298
  • the idea to switching from argparse to click in #47

akaihola avatar Feb 21 '22 11:02 akaihola

I'm actually not so sure about moving to click (see #47). If Darker moves towards being a generic reformatter/linter front-end (see #304), we might not necessarily have click installed as a dependency from another installed package. And argparse is currently serving us well.

And boolean options can be made togglable both ways with argparse as well.

I guess --myoption / --no-myoption would be a fair syntax. It also would mirror this from Black:

 --color / --no-color            Show colored diff. Only applies when
                                 `--diff` is given.

These options could be added for reversing configuration options from pyproject.toml:

  • --no-diff
  • --no-stdout
  • --no-isort
  • --no-lint <LINTER> maybe, for turning individual linters off by matching the <LINTER> string exactly?
  • --no-skip-magic-trailing-comma

akaihola avatar Apr 01 '22 18:04 akaihola