Merge pull request #4700 from marko1616/patch-1

Fix Windows command preview

Former-commit-id: bc49af1e8bde9c396ca4b1e608b7fad02b016ce6
This commit is contained in:
hoshi-hiyouga 2024-07-10 13:51:50 +08:00 committed by GitHub
commit d3bfcbd3af

View File

@ -113,7 +113,10 @@ def gen_cmd(args: Dict[str, Any]) -> str:
for k, v in clean_cmd(args).items():
cmd_lines.append(" --{} {} ".format(k, str(v)))
cmd_text = "\\\n".join(cmd_lines)
if os.name == "nt":
cmd_text = "`\n".join(cmd_lines)
else:
cmd_text = "\\\n".join(cmd_lines)
cmd_text = "```bash\n{}\n```".format(cmd_text)
return cmd_text