Skip to content

Fix empty HelpFormatter usage output#3418

Closed
nightt5879 wants to merge 1 commit into
pallets:mainfrom
nightt5879:nightt5879/fix-helpformatter-empty-usage
Closed

Fix empty HelpFormatter usage output#3418
nightt5879 wants to merge 1 commit into
pallets:mainfrom
nightt5879:nightt5879/fix-helpformatter-empty-usage

Conversation

@nightt5879
Copy link
Copy Markdown

Closes #3360

Summary

  • Make HelpFormatter.write_usage() write the usage line when called without an args string.
  • Add a regression test for a no-argument usage line.

Impact

This fixes direct HelpFormatter usage for commands or internal command-like prompts that do not take arguments. Existing usage wrapping behavior is unchanged when arguments are provided.

Validation

  • python -m pytest tests/test_formatting.py -q -> 24 passed
  • python -m pytest -q with TMP/TEMP pointed at a checkout-local temp directory -> 1441 passed, 77 skipped, 30000 deselected, 1 xfailed
  • git diff --check -> passed; only Windows line-ending conversion warnings were reported

@davidism davidism closed this May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty output from HelpFormatter.write_usage for a program without arguments

2 participants