mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
argparse: dont override cmd
Related: #6956, https://bugs.python.org/issue45235
This commit is contained in:
committed by
Ruslan Kuprieiev
parent
045d1f5e3e
commit
36ed182f26
@@ -818,7 +818,7 @@ class CmdExperimentsInit(CmdBase):
|
||||
def run(self):
|
||||
from dvc.command.stage import parse_cmd
|
||||
|
||||
cmd = parse_cmd(self.args.cmd)
|
||||
cmd = parse_cmd(self.args.command)
|
||||
if not self.args.interactive and not cmd:
|
||||
raise InvalidArgumentError("command is not specified")
|
||||
|
||||
@@ -1429,7 +1429,7 @@ def add_parser(subparsers, parent_parser):
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
)
|
||||
experiments_init_parser.add_argument(
|
||||
"cmd",
|
||||
"command",
|
||||
nargs=argparse.REMAINDER,
|
||||
help="Command to execute.",
|
||||
metavar="command",
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ class CmdRun(CmdBase):
|
||||
self.args.outs_persist_no_cache,
|
||||
self.args.checkpoints,
|
||||
self.args.params,
|
||||
self.args.cmd,
|
||||
self.args.command,
|
||||
]
|
||||
): # pragma: no cover
|
||||
logger.error(
|
||||
@@ -36,7 +36,7 @@ class CmdRun(CmdBase):
|
||||
kwargs = vars(self.args)
|
||||
kwargs.update(
|
||||
{
|
||||
"cmd": parse_cmd(self.args.cmd),
|
||||
"cmd": parse_cmd(self.args.command),
|
||||
"fname": kwargs.pop("file"),
|
||||
"no_exec": (self.args.no_exec or bool(self.args.checkpoints)),
|
||||
"run_cache": not kwargs.pop("no_run_cache"),
|
||||
|
||||
@@ -129,7 +129,7 @@ class CmdStageAdd(CmdBase):
|
||||
kwargs = vars(self.args)
|
||||
kwargs.update(
|
||||
{
|
||||
"cmd": parse_cmd(kwargs.pop("cmd")),
|
||||
"cmd": parse_cmd(kwargs.pop("command")),
|
||||
"params": parse_params(self.args.params),
|
||||
}
|
||||
)
|
||||
@@ -281,7 +281,7 @@ def _add_common_args(parser):
|
||||
),
|
||||
)
|
||||
parser.add_argument(
|
||||
"cmd",
|
||||
"command",
|
||||
nargs=argparse.REMAINDER,
|
||||
help="Command to execute.",
|
||||
metavar="command",
|
||||
|
||||
@@ -66,7 +66,7 @@ class TestRun(TestDvc):
|
||||
self.assertEqual(args.outs, [out1, out2])
|
||||
self.assertEqual(args.outs_no_cache, [out_no_cache1, out_no_cache2])
|
||||
self.assertEqual(args.file, fname)
|
||||
self.assertEqual(args.cmd, [cmd, arg1, arg2])
|
||||
self.assertEqual(args.command, [cmd, arg1, arg2])
|
||||
|
||||
cmd_cls.repo.close()
|
||||
|
||||
|
||||
@@ -590,3 +590,4 @@ def test_experiments_init_config(dvc, mocker):
|
||||
"plots": "plots",
|
||||
"live": "dvclive",
|
||||
}
|
||||
assert m.call_args[1]["overrides"] == {"cmd": "cmd"}
|
||||
|
||||
Reference in New Issue
Block a user