mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
@@ -113,8 +113,11 @@ def parse_cmd(commands: List[str]) -> str:
|
||||
"""
|
||||
|
||||
def quote_argument(arg: str):
|
||||
should_quote = " " in arg and '"' not in arg
|
||||
return f'"{arg}"' if should_quote else arg
|
||||
if not arg:
|
||||
return '""'
|
||||
if " " in arg and '"' not in arg:
|
||||
return f'"{arg}"'
|
||||
return arg
|
||||
|
||||
if len(commands) < 2:
|
||||
return " ".join(commands)
|
||||
|
||||
@@ -10,6 +10,7 @@ from dvc.command.stage import CmdStageAdd
|
||||
(["echo", "foo", "bar"], "echo foo bar"),
|
||||
(["echo", '"foo bar"'], 'echo "foo bar"'),
|
||||
(["echo", "foo bar"], 'echo "foo bar"'),
|
||||
(["cmd", "--flag", ""], 'cmd --flag ""'),
|
||||
],
|
||||
)
|
||||
def test_stage_add(mocker, dvc, command, parsed_command):
|
||||
|
||||
Reference in New Issue
Block a user