Closed
Description
Please complete the following tasks
- I have searched the discussions
Clap Version
4.0.0
Describe your use case
When flattening, I'd like to make the struct optional
#[derive(Clap)]
pub struct App{
#[clap(flatten)]
pub state_filter: Option<StateFilter>,
}
#[derive(Args)]
pub enum StateFilter {
/// Only running servers are returned
#[clap(long)]
Running,
/// Only exited servers are returned
#[clap(long)]
Exited,
/// Only restarting servers are returned
#[clap(long)]
Restarting,
#[clap(long)]
Custom(String),
}
Describe the solution you'd like
With #3165, we could check if the ArgGroup
is present and, if it isn't, return None
. Otherwise, we walk into the ArgGroup
and access it.
Alternatives, if applicable
No response
Additional Context
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
Option
when flattening #4350epage commentedon Oct 5, 2022
Oops, looks like we already have #3123, closing in favor of that though #4350 is just about to be merged, supporting this
epage commentedon Oct 5, 2022
v4.0.10