diff --git a/src/sphobjinv/cli/core.py b/src/sphobjinv/cli/core.py index 731f1f1a..a7303351 100644 --- a/src/sphobjinv/cli/core.py +++ b/src/sphobjinv/cli/core.py @@ -190,6 +190,10 @@ def main(): print(PrsConst.VER_TXT) sys.exit(0) + # At this point, need to trap for a null subparser + if not params[PrsConst.SUBPARSER_NAME]: + prs.error("No subparser selected") + # Regardless of mode, insert extra blank line # for cosmetics log_print(" ", params) diff --git a/tests/test_cli.py b/tests/test_cli.py index 03904999..99ba156f 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -80,7 +80,7 @@ def test_cli_no_subparser_prs_exit(self, run_cmdline_test): with stdio_mgr() as (in_, out_, err_): run_cmdline_test(["--foo"], expect=2) - assert "required: {convert,suggest}" in err_.getvalue() + assert "error: No subparser selected" in err_.getvalue() @pytest.mark.timeout(CLI_TEST_TIMEOUT) def test_cli_bad_subparser_prs_exit(self, run_cmdline_test):