Skip to content

Commit 93a05af

Browse files
committed
Fixed config file overrode args, matched config val to data.csv.parse() input type
1 parent 989e11c commit 93a05af

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

remove-json-keys/src/remove_json_keys/lib/settings.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,12 @@ def load(cli, caller_file):
6868
if getattr(ctrl, 'subcmd', False) and next(arg for arg in ctrl.args if arg.startswith('--'))[2:] in sys.argv:
6969
setattr(parsed_args, attr_name, True)
7070
for key, val in vars(parsed_args).items(): # apply parsed_args to cli.config
71-
if not getattr(cli.config, key, ''):
72-
setattr(cli.config, key, val)
71+
if val : setattr(cli.config, key, val)
7372
log.debug('Args parsed!\n{}', cli)
7473

7574
# Init all cli.config vals
7675
for name, ctrl in vars(controls).items():
77-
val = getattr(cli.config, name, None)
76+
val = getattr(cli.config, name, '')
7877
if getattr(ctrl, 'parser', None) == 'csv':
7978
val = data.csv.parse(val)
8079
if val is None and hasattr(ctrl, 'default_val'):

translate-messages/src/translate_messages/lib/settings.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,12 @@ def load(cli, caller_file):
7878
if getattr(ctrl, 'subcmd', False) and next(arg for arg in ctrl.args if arg.startswith('--'))[2:] in sys.argv:
7979
setattr(parsed_args, attr_name, True)
8080
for key, val in vars(parsed_args).items(): # apply parsed_args to cli.config
81-
if not getattr(cli.config, key, ''):
82-
setattr(cli.config, key, val)
81+
if val : setattr(cli.config, key, val)
8382
log.debug('Args parsed!\n{}', cli)
8483

8584
# Init all cli.config vals
8685
for name, ctrl in vars(controls).items():
87-
val = getattr(cli.config, name, None)
86+
val = getattr(cli.config, name, '')
8887
if getattr(ctrl, 'parser', None) == 'csv':
8988
val = data.csv.parse(val)
9089
if val is None and hasattr(ctrl, 'default_val'):

0 commit comments

Comments
 (0)