// builder api
let cli = Command::new("progname")
.arg(Arg::new("arg1").long("arg1").action(ArgAction::SetTrue))
.arg(Arg::new("arg2").long("arg2").requires("arg1"));
// derive api
#[derive(clap::Parser)]
struct Cli {
#[arg(long)]
arg1: bool,
#[arg(long, requires("arg1"))]
arg2: Option<String>,
}
it has the behavior as described, but will give only generic error messages like "required argument not provided". if the special error message is required, you'll have to format the message yourself, see e.g. the example in the custom validation section of the documentation:
I don't really get it but I am using the newest version now and it works.
Makes no sense as it should work in 3.2.23 where I would have a colored help page but I guess I'll have to live without it.
stupid