How can I model extra arguments with clap?

55 Views Asked by At

Let's say I have a program, foobar which must have a --browser argument set.

foobar --browser chrome

Now, I want to add a subcommand,

foobar --browser chrome cookies

Now, because the browser was set to chrome, I want to enable extra arguments for the cookies subcommand,

foobar --browser chrome cookies --chrome-foo=bar

I do not want --chrome-foo to be available for chrome browsers, and only on chrome browsers. Is there a way to model this with clap? Can it be done entirely with the derive model?

0

There are 0 best solutions below