Skip to content
Open
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
2 changes: 1 addition & 1 deletion src/click/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def wrap_text(
replace_whitespace=False,
)
if not preserve_paragraphs:
return wrapper.fill(text)
return wrapper.fill(text) if text else initial_indent

p: list[tuple[int, bool, str]] = []
buf: list[str] = []
Expand Down
7 changes: 7 additions & 0 deletions tests/test_formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,3 +433,10 @@ def test_help_formatter_write_text():
actual = formatter.getvalue()
expected = " Lorem ipsum dolor sit amet,\n consectetur adipiscing elit\n"
assert actual == expected


def test_help_formatter_write_usage_without_args():
f = click.HelpFormatter()
f.write_usage("Program")
expected = "Usage: Program \n"
assert f.getvalue() == expected