I've got something like the following struct:
#[derive(Debug, StructOpt)]
#[structopt(about = "Foo")]
struct Options {
#[structopt(short, long)]
pub output: PathBuf,
#[structopt(short, long))]
pub foo: Option<PathBuf>,
#[structopt(long, required_unless("foo"))]
pub barOption<PathBuf>,
#[structopt(short, long)]
pub debug: bool,
}
I want to have argument bar
as required if argument foo
is present. Unfortunately the behavior above is exactly the opposite. I've seen in the documentation that there is a required_if
. But this parameter needs a specific value, but the value for foo
is arbitrary. So is there something like required_if("foo")
possible?