diff --git a/dvc/command/experiments.py b/dvc/command/experiments.py index c256b59ad..27dcf6bf8 100644 --- a/dvc/command/experiments.py +++ b/dvc/command/experiments.py @@ -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", diff --git a/dvc/command/run.py b/dvc/command/run.py index 079894061..e511d192d 100644 --- a/dvc/command/run.py +++ b/dvc/command/run.py @@ -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"), diff --git a/dvc/command/stage.py b/dvc/command/stage.py index aab3c1c65..f8afe45c5 100644 --- a/dvc/command/stage.py +++ b/dvc/command/stage.py @@ -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", diff --git a/tests/func/test_cli.py b/tests/func/test_cli.py index 079276155..e1cb844d3 100644 --- a/tests/func/test_cli.py +++ b/tests/func/test_cli.py @@ -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() diff --git a/tests/unit/command/test_experiments.py b/tests/unit/command/test_experiments.py index 3b00c4716..42cb9dd4b 100644 --- a/tests/unit/command/test_experiments.py +++ b/tests/unit/command/test_experiments.py @@ -590,3 +590,4 @@ def test_experiments_init_config(dvc, mocker): "plots": "plots", "live": "dvclive", } + assert m.call_args[1]["overrides"] == {"cmd": "cmd"}