Is it possible to define a default value for an argument based on another argument?
For example in the following code:
use clap::Parser;
#[derive(Parser, Debug)]
struct Args {
#[arg(long)]
name1: String,
#[arg(long)]
name2: String,
}
fn main() {
let args = Args::parse();
println! {"{}", args.name1};
println! {"{}", args.name2};
}
I would like to have name2 use name1 as a default if it is not passed explicitly.
NOTE: My question is regarding whether it is possible (and how) to do that as part of the struct itself