Hi,
Using 5.0.4 of the api, its very compact and allows you to express complex arg requirements neatly:) I am pretty new to it and i have not been able to figure out how to create a parser which will require the user to pass a host flag with a required value or a host.file flag with a required value, but not both.
This should pass:
--host="host1,host2"
This should pass
--host.file="c:/aldjfsdfj"
This should fail
--host.file="c:/aldjfsdfj" --host="host1,host2"
This should fail because either host or host.file is required.
--blah
I assumed I could use
parser.mutuallyExclusive(parser.accepts(HOSTS).withRequiredArg().required(),parser.accepts(HOSTS_FILE).withRequiredArg().required());
This doesn't compile :) I also tried the below approach which require hosts even if host.file is present. I couldn't find a unit test that matched this scenario in the codebase.
parser.mutuallyExclusive(parser.accepts(HOSTS),parser.accepts(HOSTS_FILE));
parser.accepts(HOSTS_FILE).withRequiredArg().required();
parser.accepts(HOSTS).withRequiredArg().required();
Any advice would be greatly appreciated.
Thanks
Geoff