I'm just wondering if there is any way in the Apache Commons CLI library to indicate that exactly one argument should be provided?
eg. I have 2 command line arguments, but should one (no more or no less) be provided? I want either ip or msisdn, but not both, not both:
OptionBuilder.hasArg(true);
OptionBuilder.withDescription("Bla bla");
OptionBuilder.isRequired(false);
commandLineOptions.addOption(OptionBuilder.create("ip"));
OptionBuilder.hasArg(true);
OptionBuilder.withDescription("Bla bla");
OptionBuilder.isRequired(false);
commandLineOptions.addOption(OptionBuilder.create("msisdn"));
Many thanks!
source
share