diff --git a/src/main.cpp b/src/main.cpp index 55e8a24..35a21eb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,12 +28,17 @@ int main(int argc, char** argv) branch_subcommand(lg2_obj, app); checkout_subcommand(lg2_obj, app); - app.parse(argc, argv); + CLI11_PARSE(app, argc, argv); if (version->count()) { std::cout << "git2cpp version " << GIT2CPP_VERSION_STRING << " (libgit2 " << LIBGIT2_VERSION << ")" << std::endl; } + + if (app.get_subcommands().size() == 0) + { + std::cout << app.help() << std::endl; + } } catch (const CLI::Error& e) { diff --git a/test/test_git.py b/test/test_git.py index 899c054..67955ac 100644 --- a/test/test_git.py +++ b/test/test_git.py @@ -14,6 +14,6 @@ def test_version(git2cpp_path, arg): def test_error_on_unknown_option(git2cpp_path): cmd = [git2cpp_path, '--unknown'] p = subprocess.run(cmd, capture_output=True) - assert p.returncode == 1 + assert p.returncode == 109 assert p.stdout == b'' assert p.stderr.startswith(b"The following argument was not expected: --unknown") diff --git a/test/test_init.py b/test/test_init.py index 8f0ce9a..fa23ebf 100644 --- a/test/test_init.py +++ b/test/test_init.py @@ -43,7 +43,7 @@ def test_init_in_cwd(git2cpp_path, tmp_path, run_in_tmp_path): def test_error_on_unknown_option(git2cpp_path): cmd = [git2cpp_path, 'init', '--unknown'] p = subprocess.run(cmd, capture_output=True) - assert p.returncode == 1 + assert p.returncode == 109 assert p.stdout == b'' assert p.stderr.startswith(b"The following argument was not expected: --unknown") @@ -51,6 +51,6 @@ def test_error_on_unknown_option(git2cpp_path): def test_error_on_repeated_directory(git2cpp_path): cmd = [git2cpp_path, 'init', 'abc', 'def'] p = subprocess.run(cmd, capture_output=True) - assert p.returncode == 1 + assert p.returncode == 109 assert p.stdout == b'' assert p.stderr.startswith(b"The following argument was not expected: def")