diff --git a/dis_cli.py b/dis_cli.py index 791160f..b86bd74 100644 --- a/dis_cli.py +++ b/dis_cli.py @@ -62,6 +62,7 @@ @click.option( "-p/-P", "--paging/--no-paging", + "--pager/--no-pager", default=None, help="Enable/disable displaying output using the system pager. Default: enabled if the output is taller than your terminal window.", ) @@ -79,6 +80,11 @@ def cli( Any number of TARGETs may be passed; they will be displayed sequentially. """ + if len(target) == 0: + ctx = click.get_current_context() + click.echo(ctx.get_help()) + return + # Make sure the cwd (implicit starting point for the import path) is actually on PYTHONPATH. # Since Python automatically adds the cwd on startup, this is only really necessary in the test suite, # but it's convenient to do it here for sanity. diff --git a/setup.cfg b/setup.cfg index 0a6e0b0..4453067 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = dis_cli -version = 0.2.0 +version = 0.2.1 description = A tool to inspect disassembled Python code on the command line. long_description = file: README.md long_description_content_type = text/markdown diff --git a/tests/test_cli.py b/tests/test_cli.py index 3fc4463..6118862 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -219,3 +219,10 @@ def test_column_width(terminal_width, line_num_width, ratio, expected): calculate_column_widths(line_num_width, ratio=ratio, terminal_width=terminal_width) == expected ) + + +def test_no_targets_prints_help(cli): + result = cli([]) + + assert result.exit_code == 0 + assert "TARGET" in result.output