Skip to content

Fix usage string for invoke_without_command groups to mark subcommand as optional#3271

Closed
siddmoparti wants to merge 2 commits into
pallets:stablefrom
siddmoparti:fix-3059-optional-command-help
Closed

Fix usage string for invoke_without_command groups to mark subcommand as optional#3271
siddmoparti wants to merge 2 commits into
pallets:stablefrom
siddmoparti:fix-3059-optional-command-help

Conversation

@siddmoparti
Copy link
Copy Markdown

Fixes #3059

When a group is created with invoke_without_command=True, the help usage string currently shows:

COMMAND [ARGS]...

which incorrectly implies that a subcommand is required. However, in this configuration, the group can be invoked without a subcommand.

This change updates the default subcommand_metavar so that the usage string correctly reflects optional behavior:

[COMMAND] [ARGS]...

The change is limited to non-chain groups with invoke_without_command=True, and does not affect existing behavior for other group configurations.

A regression test has been added to verify that the usage output includes [COMMAND] [ARGS]... when --help is invoked.

Let me know if any adjustments are needed.

themavik

This comment was marked as spam.

@kdeldycke
Copy link
Copy Markdown
Collaborator

@Rowlando13 , you removed the author original comment at #3059 (comment) . Does this mean this PR is AI slop? CC @davidism

@kdeldycke kdeldycke changed the base branch from main to stable April 16, 2026 09:35
@Rowlando13
Copy link
Copy Markdown
Collaborator

@kdeldycke Not sure. @siddmoparti Did you do this using AI or are you just new?

@Rowlando13 Rowlando13 marked this pull request as draft April 29, 2026 06:15
@kdeldycke kdeldycke added this to the 8.4.2 milestone May 22, 2026
@kdeldycke kdeldycke added f:command feature: commands f:help feature: help text labels May 22, 2026
@kdeldycke
Copy link
Copy Markdown
Collaborator

@kdeldycke Not sure. @siddmoparti Did you do this using AI or are you just new?

No feedback for a couple of month, so I propose to close that PR as invalid. I will produce a new one for #3059

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f:command feature: commands f:help feature: help text invalid

Projects

None yet

Development

Successfully merging this pull request may close these issues.

With invoke_without_command set, commands are not marked as optional

4 participants