Skip to content

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

Open
siddmoparti wants to merge 2 commits intopallets:mainfrom
siddmoparti:fix-3059-optional-command-help
Open

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

Conversation

@siddmoparti
Copy link

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.

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.

With invoke_without_command set commands are not marked as optional

2 participants