Skip to content

The only downloader you need. 下载器的集大成者。

fix(cli): --help 和 --version 输出末尾不再多空行

XiaoYouChRbb977858fa1e
diff --git a/app/cli.py b/app/cli.py
index 1ef7462c..1ad18377 100644
--- a/app/cli.py
+++ b/app/cli.py
@@ -160,7 +160,7 @@ class Cli:
try:
args = self._parser.parse_args(argv[1:])
except TextRequested as text:
- reply(Reply(str(text), 0))
+ reply(Reply(str(text).rstrip("\n"), 0))
return
except UsageError as error:
reply(toError("usage", str(error), 2))
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 75bc0b69..c4b59e22 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -93,6 +93,7 @@ def test_help_lists_commands(cli):
[reply] = replies
assert reply.exitCode == 0
assert "add" in reply.output and "wait" in reply.output
+ assert not reply.output.endswith("\n")
@@ -103,7 +104,7 @@ def test_version_replies_running_version(cli):
[reply] = replies
assert reply.exitCode == 0
- assert VERSION in reply.output
+ assert reply.output == f"ghd {VERSION}"
async def test_wait_returns_when_task_completes(cli, engine):
task = buildTask("complete")