Replies: 3 comments 3 replies
-
Also changing the /// Flag to dump the packet data
#[arg(short, long)]
#[arg(requires="dumper")]
#[clap(default_value_t = false)]
pub dump: bool,
#[command(flatten)]
pub dumper: DumpArgs,
|
Beta Was this translation helpful? Give feedback.
-
You are likely running into a problem with your struct design. When populating The best option is likely #[command(flatten)]
- pub dumper: DumpArgs,
+ pub dumper: Option<DumpArgs>, |
Beta Was this translation helpful? Give feedback.
-
I'm bumping into this today, I made a PR to an example repo to demonstrate a) the issue, b) the desired approach. @epage would really appreciate it if you could put some effort into this for clap v5 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
this is my current setup:
What I'm trying to do is, make it so that if the argument dump is present, then the entire group DumpArgs (from the struct) is required too. However, it doesn't seem to work properly, it seems to think that the arguments in DumpArgs (address, email) are always required. I don't know how to fix this, help would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions