8000 Generate a man page for a command without a help text by bercedev · Pull Request #81 · click-contrib/click-man · GitHub
[go: up one dir, main page]

Skip to content

Generate a man page for a command without a help text - #81

Open
bercedev wants to merge 1 commit into
click-contrib:masterfrom
bercedev:fix/command-without-help
Open

bercedev wants to merge 1 commit into
click-contrib:masterfrom
bercedev:fix/command-without-help

Conversation

@bercedev
Copy link
Copy Markdown

Fixes #80

generate_man_page passed ctx.command.help straight to inspect.cleandoc, which fails on None. Any command or subcommand defined without a docstring or help= raised AttributeError: 'NoneType' object has no attribute 'expandtabs', as in the issue (hatch's man pages).

It now uses cleandoc(ctx.command.help or ''). ManPage already leaves out the DESCRIPTION section when the description is empty, so such a command gets a page with NAME and SYNOPSIS only. get_short_help_str already handled a missing help text the same way.

test_issue_80 in tests/test_issues.py builds a Command without help, then checks that the page has a SYNOPSIS and no DESCRIPTION. It fails on master with the AttributeError. pytest tests: 8 passed. ruff 0.11.4 (the pre-commit version) check and format are clean.

Note: I used Claude Code while working on this.

generate_man_page passed ctx.command.help to inspect.cleandoc, which fails on None, so a subcommand without help raised AttributeError. Fixes click-contrib#80.

This branch has not been deployed

No deployments
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.

AttributeError in generate_man_page when a subcommand has no help message

1 participant

0