From 44a4d966be2ba755dd05536a79d121e6d4865aa4 Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Fri, 5 Jul 2024 11:11:45 +0200 Subject: [PATCH] Nicer --- cli/trd.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cli/trd.py b/cli/trd.py index cde300a..3c4612c 100644 --- a/cli/trd.py +++ b/cli/trd.py @@ -16,6 +16,10 @@ def _progress(msg): print(msg) +def _version(): + return version("traduire_cli") + + def current_project(): config = Path.home() / ".config" / "traduire.toml" if not config.exists(): @@ -51,13 +55,15 @@ def url_from_pofile(project, pofile): def main(): if len(sys.argv) != 3 or sys.argv[1] not in {"get", "submit", "replace"}: - _terminate(f"Usage: {sys.argv[0]} [get,submit,replace] path") + _terminate( + f"traduire-cli {_version()}\nUsage: {Path(sys.argv[0]).name} [get,submit,replace] path" + ) project = current_project() session = requests.Session() session.headers = { "x-token": project["token"], - "x-cli-version": version("traduire_cli"), + "x-cli-version": _version(), } if sys.argv[1] == "get":