ITADN

confusing `--help` caused by ArgGroup

#6361Openloynoir 创建于 2026-05-02
C-bugS-triage
L
loynoircommented
### Please complete the following tasks - [x] I have searched the [discussions](https://github.com/clap-rs/clap/discussions) - [x] I have searched the [open](https://github.com/clap-rs/clap/issues) and [rejected](https://github.com/clap-rs/clap/issues?q=is%3Aissue+label%3AS-wont-fix+is%3Aclosed) issues ### Rust Version rustc 1.97.0-nightly ### Clap Version 4.6.1 ### Minimal reproducible code ```rust use clap::{ArgGroup, Parser, ValueEnum}; #[derive(Parser)] #[command( disable_help_flag = false, version, name = "...", about = "...", group = ArgGroup::new("path_group") .required(true) .args(["path_pos", "path_flag"]), )] struct Cli { #[arg(index = 1, value_enum)] action: Action, #[arg(short = 'p', long = "path", value_name = "PATH", group = "path_group")] path_flag: Option<String>, #[arg(index = 2, value_name = "PATH", group = "path_group")] path_pos: Option<String>, } #[derive(ValueEnum, Clone)] enum Action { Reproduce, } fn main() { Cli::parse(); } ``` ### Steps to reproduce the bug with the above code ```sh $ cargo run -- --help ``` ### Actual Behaviour ```console ... Usage: cargo-split <PATH|--path <PATH>> <ACTION> Arguments: <ACTION> [possible values: reproduce] [PATH] Options: -p, --path <PATH> -h, --help Print help -V, --version Print version ``` ### Expected Behaviour ```console ... Usage: cargo-split <-p,--path <PATH>> <ACTION> <PATH> Arguments: <ACTION> [possible values: reproduce] [PATH] Options: -p, --path <PATH> -h, --help Print help -V, --version Print version ``` ### Additional Context _No response_ ### Debug Output _No response_
0 条评论