projects
/
python_utils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8c3fdf1
)
Make config_loadfile augment cmdline instead of klobbering.
author
Scott Gasch
<
[email protected]
>
Fri, 6 Aug 2021 18:30:28 +0000
(11:30 -0700)
committer
Scott Gasch
<
[email protected]
>
Fri, 6 Aug 2021 18:30:28 +0000
(11:30 -0700)
config.py
patch
|
blob
|
history
diff --git
a/config.py
b/config.py
index b3580ceed0663bdb34b946d465ea3c2fca3b05f6..cf6d5a1e0f0d53cbf9fc3977bd553928e859d8ec 100644
(file)
--- 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:
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)
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]
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.
# Parse (possibly augmented, possibly completely overwritten)
# commandline args with argparse normally and populate config.