Skip to content

Arg::requires_if

since 0.1.0

Require another argument if this arg matches the ArgPredicate.

name = "prog"
[args]
config = { long = "config", action = "set", requires-if = { arg = "other", value = "my.cfg" } }
other = {}
Terminal window
prog --config some.cfg
Terminal window
claptrap_config='some.cfg'
name = "prog"
[args]
config = { long = "config", action = "set", requires-if = { arg = "other", value = "my.cfg" } }
other = {}
Terminal window
prog --config my.cfg
Terminal window
error: the following required arguments were not provided:
<other>
Usage: prog --config <config> <other>
For more information, try '--help'.