summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2021-08-06 11:30:28 -0700
committerScott Gasch <[email protected]>2021-08-06 11:30:28 -0700
commitf49bb9db0c6d1a8622dca1717db68462a4209112 (patch)
treeb0d648b678cc78c6ac6ba28706274750ffd19fbe
parent8c3fdf110f513719aa31d20c6f837f29c72abb43 (diff)
Make config_loadfile augment cmdline instead of klobbering.
-rw-r--r--config.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/config.py b/config.py
index b3580ce..cf6d5a1 100644
--- a/config.py
+++ b/config.py
@@ -224,10 +224,9 @@ def parse(entry_module: Optional[str]) -> Dict[str, Any]:
if loadfile is not None:
if saw_other_args:
- print(
- 'WARNING: ignoring some commandline arguments; only args in --config_loadfile be parsed.',
- file=sys.stderr
- )
+ msg = f'WARNING: Augmenting commandline arguments with those from {loadfile}.'
+ print(msg, file=sys.stderr)
+ saved_messages.append(msg)
if not os.path.exists(loadfile):
print(f'--config_loadfile argument must be a file, {loadfile} not found.',
file=sys.stderr)
@@ -235,7 +234,7 @@ def parse(entry_module: Optional[str]) -> Dict[str, Any]:
with open(loadfile, 'r') as rf:
newargs = rf.readlines()
newargs = [arg.strip('\n') for arg in newargs if 'config_savefile' not in arg]
- sys.argv = sys.argv[:1] + newargs
+ sys.argv += newargs
# Parse (possibly augmented, possibly completely overwritten)
# commandline args with argparse normally and populate config.