Skip to content

Commit

Permalink
Show help if called with no options, closes #14
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Jun 19, 2023
1 parent 9d467b8 commit b002482
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions symbex/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ def cli(symbols, files, directories, signatures, silent):
# View signatures for all test functions
symbex 'test_*' -s
"""
if not symbols and not signatures:
ctx = click.get_current_context()
click.echo(ctx.get_help())
ctx.exit()
if signatures and not symbols:
symbols = ["*"]
if not files and not directories:
Expand Down
7 changes: 7 additions & 0 deletions tests/test_symbex.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
from symbex.cli import cli


def test_no_args_shows_help():
runner = CliRunner()
result = runner.invoke(cli, catch_exceptions=False)
assert result.exit_code == 0
assert "Usage: cli [OPTIONS]" in result.stdout


@pytest.fixture
def directory_full_of_code(tmpdir):
for path, content in (
Expand Down

0 comments on commit b002482

Please sign in to comment.