diff --git a/slugify/__main__.py b/slugify/__main__.py index fde2a86..b740db1 100644 --- a/slugify/__main__.py +++ b/slugify/__main__.py @@ -25,9 +25,9 @@ def parse_args(argv: list[str]) -> argparse.Namespace: parser.add_argument("--max-length", type=int, default=0, help="Output string length, 0 for no limit") parser.add_argument("--word-boundary", action='store_true', default=False, - help="Truncate to complete word even if length ends up shorter than --max_length") + help="Truncate to complete word even if length ends up shorter than --max-length") parser.add_argument("--save-order", action='store_true', default=False, - help="When set and --max_length > 0 return whole words in the initial order") + help="When set and --max-length > 0 return whole words in the initial order") parser.add_argument("--separator", type=str, default=DEFAULT_SEPARATOR, help="Separator between words. By default " + DEFAULT_SEPARATOR) parser.add_argument("--stopwords", nargs='+', diff --git a/tests/test_cli_interrupt.py b/tests/test_cli_interrupt.py index eda9337..463cb0f 100644 --- a/tests/test_cli_interrupt.py +++ b/tests/test_cli_interrupt.py @@ -21,3 +21,11 @@ def test_keyboard_interrupt_exits_without_traceback(capsys): captured = capsys.readouterr() assert captured.out == '' assert captured.err == '' + + +def test_help_uses_hyphenated_max_length(capsys): + with pytest.raises(SystemExit): + cli.main(['slugify', '--help']) + out = capsys.readouterr().out + assert '--max_length' not in out + assert '--max-length' in out