Reputation: 4466
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 ?
Upvotes: 7
Views: 1728
Reputation: 16859
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.
Upvotes: 6