Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions slugify/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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='+',
Expand Down
8 changes: 8 additions & 0 deletions tests/test_cli_interrupt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading