Skip to content

Preserve custom help formatters in subcommands - #247

Open
BelodonaQ wants to merge 1 commit into
neithere:release/v0.31.4from
BelodonaQ:codex/preserve-subcommand-formatters
Open

BelodonaQ wants to merge 1 commit into
neithere:release/v0.31.4from
BelodonaQ:codex/preserve-subcommand-formatters

Conversation

@BelodonaQ

Copy link
Copy Markdown

Subcommands currently discard a custom formatter configured on their parent parser. This makes multiline help collapse back to the default formatting, including for grouped commands.

Inherit the custom parent formatter for command and group parsers while preserving explicit func_kwargs overrides. Keep Argh's existing default formatter when the parent uses argparse's default HelpFormatter.

Fixes #238.

Validation: four custom-formatter regression cases fail before the fix and pass afterward. The full suite passes with 180 tests and 100% coverage on Python 3.14.7. Ruff 0.4.9 lint and formatting checks and git diff --check pass. Tests cover direct/grouped commands, plain ArgumentParser and ArghParser, explicit overrides, and default formatting compatibility.

Prepared and verified with OpenAI Codex assistance.

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.

1 participant