Can I make a required option not required if anoth...
# clikt
s
Can I make a required option not required if another option is specified? My use case is a
--dry-run
flag. If it's specified, the output directory does not have to be specified (via
-o
), but it can be specified (as it will not be written to anyway).
a
If they were both flags, you could use
switch()
, but for your case I would just do it in `run`:
if (!dryRun && output == null) throw UsageError()
s
And remove
required()
from
output
obviously...