Skip to content

Stop collecting subcommand names into .allUnrecognized arguments - #1002

Open
aniketatgithub wants to merge 1 commit into
apple:mainfrom
aniketatgithub:fix-796-allunrecognized-subcommand
Open

aniketatgithub wants to merge 1 commit into
apple:mainfrom
aniketatgithub:fix-796-allunrecognized-subcommand

Conversation

@aniketatgithub

Copy link
Copy Markdown

Fixes #796

A parent command with @Argument(parsing: .allUnrecognized) swallowed its subcommand names, so ./App list 1 ran the parent with ["list", "1"] instead of dispatching to the list subcommand. A subcommand name is recognized input, not unrecognized input, so LenientParser now stops collecting into the .allUnrecognized argument at the first value matching a subcommand name (or the built-in help subcommand), leaving it for subcommand dispatch. Values before the subcommand name still stay with the parent, and values after -- are still treated as literal data.

Adds a regression test covering dispatch, values before the subcommand name, and list --help / help list.

Signed-off-by: Aniket <aniketkomailkro@gmail.com>

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.

Overpowered @Argument(parsing: .allUnrecognized)

1 participant