ConfigArgParse icon indicating copy to clipboard operation
ConfigArgParse copied to clipboard

Boolean options in higher priority configs ignored

Open yunesj opened this issue 7 years ago • 2 comments

main.py:

parser = configargparse.get_argument_parser(default_config_files=['default.cfg', 'user.cfg'])
parser.add('--key', action='store_true')
args = parser.parse_args()

default.cfg:

key: True

user.cfg:

key: False

args.key will be True

This is because, config files are processed in descending priority, and when using store_true in the config files, key = False is ignored rather than considered already_on_command_line.

yunesj avatar Oct 26 '17 18:10 yunesj

If you can submit a PR, it would be much appreciated.

I threw in handling for boolean and list values early on (https://github.com/bw2/ConfigArgParse#special-values), in a way that handles simple cases but doesn't generalize. It would be great if someone could take on refactoring this.

bw2 avatar Dec 26 '17 19:12 bw2

It would be super useful if "someone" could fix this. We use ConfigArgParse in locust (https://github.com/locustio/locust/).

Sorry for the "me too"-type post, but I just wanted to let you know how much we appreciate this library and how awesome it would be if this tiny thing were to be fixed :)

cyberw avatar Mar 06 '20 09:03 cyberw