You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
jrose-signal opened this issue
Aug 5, 2024
· 1 comment
Labels
A-helpArea: documentation, including docs.rs, readme, examples, etc...C-bugCategory: Updating dependenciesE-mediumCall for participation: Experience needed to fix: Medium / intermediate
use clap::*;// 4.5.11#[derive(Parser)]structTopLevel{first:String,#[command(flatten)]second:Inner,}// *** Note: the user can specify *either* a positional argument *or* a named argument#[derive(Args)]#[group(required = true, multiple = false)]structInner{value:Option<String>,#[arg(long)]path:Option<String>,}fnmain(){letmut cmd = TopLevel::command();
_ = cmd.print_long_help();let parsed = TopLevel::parse_from(["test","a","b"]);assert_eq!(parsed.first, "a");assert_eq!(parsed.second.value, "b");}
Steps to reproduce the bug with the above code
Run on play.rust-lang.org
Actual Behaviour
Usage: playground <VALUE|--path <PATH>> <FIRST>
even though the assertions show that the FIRST argument is in fact getting parsed first, as desired.
Expected Behaviour
Usage: playground <FIRST> <VALUE|--path <PATH>>
It does work to put the flag argument after the first positional argument, so this isn't even wrong, even if it's a little unconventional.
Additional Context
I tried manually specifying index on the arguments, but it did not affect the help output.
Debug Output
No response
The text was updated successfully, but these errors were encountered:
epage
added
A-help
Area: documentation, including docs.rs, readme, examples, etc...
E-medium
Call for participation: Experience needed to fix: Medium / intermediate
labels
Aug 5, 2024
A-helpArea: documentation, including docs.rs, readme, examples, etc...C-bugCategory: Updating dependenciesE-mediumCall for participation: Experience needed to fix: Medium / intermediate
Please complete the following tasks
Rust Version
1.80.0
Clap Version
4.5.11
Minimal reproducible code
Steps to reproduce the bug with the above code
Run on play.rust-lang.org
Actual Behaviour
even though the assertions show that the
FIRST
argument is in fact getting parsed first, as desired.Expected Behaviour
It does work to put the flag argument after the first positional argument, so this isn't even wrong, even if it's a little unconventional.
Additional Context
I tried manually specifying
index
on the arguments, but it did not affect the help output.Debug Output
No response
The text was updated successfully, but these errors were encountered: