-
Notifications
You must be signed in to change notification settings - Fork 8
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
Make CLI in line with intended default for increment_micro #329
Make CLI in line with intended default for increment_micro #329
Conversation
Hmm the fact that the tests still pass also suggest there's a missing test case somewhere.. |
Yeah, tests are not fully covered yet. Currently, changing the command-line argument would introduce a breaking change. Sorry for being a little cautious about this, but I might find a workaround using meta-vars... Give me a day or two |
No problem, take your time |
As far as I could tell, the CLI is setting the increment_micro option so the defaults deeper within the codebase are just overwritten |
Ah, as the smallest supported python version is 3.9, the import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--foo', action=argparse.BooleanOptionalAction) # Added in version 3.9.
parser.parse_args(['--no-foo'])
Namespace(foo=False) This should be combinable with default values. So, a possible solution would be
I could give it a try, when I'm home tomorrow. |
Nice. You might need to get rid of |
Unfortunately, the BooleanOptionalAction is still a bit buggy, but I managed it to setup a working implementation with a mutual exclusive argument group. |
It would also be possible to use store_const and have different None handling, see e.g. https://docs.python.org/3/library/argparse.html
Micro and no-micro can now be used. Micro is the default, no-micro must explicitly enabled. Both values can be set to false, IF old behavior shall be restored
119350f
to
8d744ef
Compare
Seems to work in the quick test I did, thanks! |
@carstencodes I think this would fix #326,
but I'm not certain about any side effects.
A different solution would be to use store_const
and have different None handling, see e.g.
https://docs.python.org/3/library/argparse.html.
Again, not sure of side effects.