diff --git a/src/click/formatting.py b/src/click/formatting.py index 0b64f831b..7b272c1b1 100644 --- a/src/click/formatting.py +++ b/src/click/formatting.py @@ -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] = [] diff --git a/tests/test_formatting.py b/tests/test_formatting.py index c74b53a3d..e1530c4d8 100644 --- a/tests/test_formatting.py +++ b/tests/test_formatting.py @@ -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