7

I use apache commons-cli for a command line tool. I have pairs of dependent arguments, e.g argument B makes sense only if argument A is present. That will have 2 benefits : automatic warning/error and a more usefull usage statment . Does commons-cli support it ?

4

1 回答 1

6

It does not; you have to enforce such things manually. CLI has OptionGroups, but they are purely mutually exclusive options, not dependent options. See JavaDoc for Option, OptionBuilder (which I highly recommend using) and the previously mentioned OptionGroup.

于 2013-04-13T12:54:21.577 回答