diff --git a/src/semantic_release/cli/commands/main.py b/src/semantic_release/cli/commands/main.py index c10d3f647..71c5f0778 100644 --- a/src/semantic_release/cli/commands/main.py +++ b/src/semantic_release/cli/commands/main.py @@ -61,6 +61,7 @@ def get_command(self, _ctx: click.Context, name: str) -> click.Command | None: cls=Cli, context_settings={ "help_option_names": ["-h", "--help"], + "resilient_parsing": True, }, ) @click.version_option( diff --git a/tests/e2e/test_main.py b/tests/e2e/test_main.py index 8ce3c58a5..b7e8d00d0 100644 --- a/tests/e2e/test_main.py +++ b/tests/e2e/test_main.py @@ -61,12 +61,12 @@ def test_main_prints_version_and_exits(run_cli: RunCliFn): assert result.output == f"semantic-release, version {__version__}\n" -def test_main_no_args_passes_w_help_text(): +def test_main_no_args_fails_w_help_text(): from semantic_release.cli.commands.main import main cli_cmd = [MAIN_PROG_NAME] result = CliRunner().invoke(main, prog_name=cli_cmd[0]) - assert_successful_exit_code(result, cli_cmd) + assert_exit_code(2, result, cli_cmd) assert "Usage: " in result.output