I have a CLI written in structopt. It should provide different ways of specifying a thingy
:
- The default
thingy
- A
thingy
explicitly defined on the command line - The first
thingy
found in the given file - The
n
ththingy
found 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
?