Replace - with _ in command names

We might as well be nice if user accidentally types --training.use-gpu
This commit is contained in:
Ines Montani 2020-07-10 22:34:22 +02:00
parent bfa8e11ffa
commit fb6f6f584e
1 changed files with 1 additions and 1 deletions

View File

@ -53,7 +53,7 @@ def parse_config_overrides(args: List[str]) -> Dict[str, Any]:
opt = args.pop(0) opt = args.pop(0)
err = f"Invalid config override '{opt}'" err = f"Invalid config override '{opt}'"
if opt.startswith("--"): # new argument if opt.startswith("--"): # new argument
opt = opt.replace("--", "") opt = opt.replace("--", "").replace("-", "_")
if "." not in opt: if "." not in opt:
msg.fail(f"{err}: can't override top-level section", exits=1) msg.fail(f"{err}: can't override top-level section", exits=1)
if not args or args[0].startswith("--"): # flag with no value if not args or args[0].startswith("--"): # flag with no value