Skip to content

Arg::required_unless_present

since 0.1.0

Set this arg as required as long as the specified argument is not present at runtime.

name = "prog"
[args]
cfg = { long = "config", required-unless-present = "dbg", action = "set" }
dbg = { long = "debug", action = "set-true" }
Terminal window
prog --debug
Terminal window
claptrap_dbg='true'
name = "prog"
[args]
cfg = { long = "config", required-unless-present = "dbg", action = "set" }
dbg = { long = "debug", action = "set-true" }
Terminal window
prog
Terminal window
error: the following required arguments were not provided:
--config <cfg>
Usage: prog --config <cfg>
For more information, try '--help'.