From f5d7812eaa85555f1095c6b394bfbee1f4d35701 Mon Sep 17 00:00:00 2001 From: comex Date: Tue, 15 Nov 2016 21:56:00 -0500 Subject: fix bool arguments with false default --- script/mconfig.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'script') diff --git a/script/mconfig.py b/script/mconfig.py index 0030f60..39d801a 100644 --- a/script/mconfig.py +++ b/script/mconfig.py @@ -274,7 +274,7 @@ class Option(object): if not self.show: # If you didn't mention the option in help, you don't get no stinking value. This is for ignored options only. return - if value is (False if self.bool else None): + if value is None: value = self.default if callable(value): # Pending value = value() @@ -388,11 +388,13 @@ def _make_argparse(include_unused, include_env): action='store_true' if opt.bool else 'store', dest=opt.name[2:], help=opt.help, + default=None, **kw) if opt.bool and include_unused: ag.add_argument(opt.opposite, action='store_false', dest=opt.name[2:], + default=None, **kw) return parser -- cgit v1.2.3