Skip to content

🐛 fix(prog): propagate :prog: override to subcommands#288

Merged
gaborbernat merged 1 commit intotox-dev:mainfrom
gaborbernat:fix-prog-subcommands
Mar 2, 2026
Merged

🐛 fix(prog): propagate :prog: override to subcommands#288
gaborbernat merged 1 commit intotox-dev:mainfrom
gaborbernat:fix-prog-subcommands

Conversation

@gaborbernat
Copy link
Member

When using the :prog: directive option to rename the program, only the top-level parser's prog was updated. Subcommand parsers still retained the original prog value, producing inconsistent section titles and cross-references in the generated documentation.

The fix recursively walks all subparser trees via _update_sub_parser_prog and replaces the old prog prefix with the new one. This ensures that titles like my-tool foo appear correctly instead of original-name foo.

Fixes #71

@gaborbernat gaborbernat added the bug Something isn't working label Mar 2, 2026
@gaborbernat gaborbernat closed this Mar 2, 2026
@gaborbernat gaborbernat reopened this Mar 2, 2026
@gaborbernat gaborbernat force-pushed the fix-prog-subcommands branch from c91ab36 to bedd7e6 Compare March 2, 2026 03:58
When using the :prog: directive option to rename the program, only the
top-level parser prog was updated. Subcommand parsers still retained the
original prog, producing inconsistent titles and references.

Recursively updates all subparser prog values when :prog: is set.

Fixes tox-dev#71
@gaborbernat gaborbernat force-pushed the fix-prog-subcommands branch from bedd7e6 to e470565 Compare March 2, 2026 04:01
@gaborbernat gaborbernat merged commit d7c5092 into tox-dev:main Mar 2, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

:prog: does not take effect for subcommands

1 participant