I have a CLI written in structopt. It should provide different ways of specifying a thingy:
- The default
thingy - A
thingyexplicitly defined on the command line - The first
thingyfound in the given file - The
nththingyfound in the given file
This leads to the following use cases:
prog # default thingy
prog -t abc # parse abc into thingy
prog -f file # first thingy in file
prog -f file -n 3 # 3rd thingy in file
prog -n 3 # ERROR: -n requires -f
prog -t abc -f f # ERROR: -t and -f conflict
prog -t abc -n 3 # ERROR: -t and -n conflict / -n requires -f
Can you suggest a clean way to express these relationships in structopt?