-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
C-bugCategory: bugCategory: bugS-triageStatus: New; needs maintainer attention.Status: New; needs maintainer attention.
Description
Please complete the following tasks
- I have searched the discussions
- I have searched the open and rejected issues
Rust Version
rustc 1.91.1 (ed61e7d7e 2025-11-07)
Clap Version
4.5.53
Minimal reproducible code
#[derive(Parser)]
#[command()]
enum CommandExample {
TestCommand
}
pub(crate) fn main() {
CommandExample::parse();
}Steps to reproduce the bug with the above code
cargo run -- help abc
Actual Behaviour
error: unrecognized subcommand 'abc'
Usage: cli
Expected Behaviour
Either displaying the normal help command like cargo run -- help would do:
Usage: cli
Commands:
test-command
help Print this message or the help of the given subcommand(s)Options:
-h, --help Print help
Or displaying an accurate error message that the argument is unexpected like cargo run -- test-command abc would do:
error: unexpected argument 'abc' found
Usage: cli help
Additional Context
The given error message is inaccurate as this abc isn't a subcommand but an argument for the help subcommand (that shouldn't exist). I assume this is an edge case that hasn't been tested.
Debug Output
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCategory: bugCategory: bugS-triageStatus: New; needs maintainer attention.Status: New; needs maintainer attention.