Please complete the following tasks
Clap Version
3.0.0-beta
Describe your use case
Use case: I would like to merge ArgMatches into Config settings using the following rules:
- ArgMatches have higher precedence over Config if they are explicitly set.
- If config setting is present but ArgMatches has an argument with default value then config value is taken.
- If config does not set the setting, then ArgMatches default value it taken.
In order to do this, I would need to iterate over ArgMatches.args and query MatchedArg.ty field.
Describe the solution you'd like
Some sort of interface that allows me to do this.
Alternatives, if applicable
Currently, I have to declare all fields in clap structure with Option<> and without default values in order to expose similar semantics. For example,
struct MyOpts {
#[clap(short, long, default_value="80")]
port: Option<u16>,
}
instead of
struct MyOpts {
#[clap(short, long, default_value="8080")]
port: u16,
}
Additional Context
No response
Please complete the following tasks
Clap Version
3.0.0-beta
Describe your use case
Use case: I would like to merge ArgMatches into Config settings using the following rules:
In order to do this, I would need to iterate over ArgMatches.args and query
MatchedArg.tyfield.Describe the solution you'd like
Some sort of interface that allows me to do this.
Alternatives, if applicable
Currently, I have to declare all fields in clap structure with
Option<>and without default values in order to expose similar semantics. For example,instead of
Additional Context
No response