From 2a167d7c4578b8a9016e82f55428732605f4695b Mon Sep 17 00:00:00 2001 From: Ian Thomas Date: Tue, 29 Jul 2025 10:11:18 +0100 Subject: [PATCH] Print version without help information --- src/main.cpp | 2 +- test/test_git.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index ca92d6d..f976363 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -39,7 +39,7 @@ int main(int argc, char** argv) std::cout << "git2cpp version " << GIT2CPP_VERSION_STRING << " (libgit2 " << LIBGIT2_VERSION << ")" << std::endl; } - if (app.get_subcommands().size() == 0) + if (app.get_subcommands().size() == 0 && !version) { std::cout << app.help() << std::endl; } diff --git a/test/test_git.py b/test/test_git.py index 67955ac..8bf5e4f 100644 --- a/test/test_git.py +++ b/test/test_git.py @@ -8,7 +8,8 @@ def test_version(git2cpp_path, arg): p = subprocess.run(cmd, capture_output=True) assert p.returncode == 0 assert p.stderr == b'' - assert p.stdout.startswith(b'git2cpp ') + assert p.stdout.startswith(b'git2cpp version ') + assert p.stdout.count(b'\n') == 1 def test_error_on_unknown_option(git2cpp_path):