/**
* An option that may be specified more than once.
*
* @throws ParseException
*/
@Test
public void testMultipleInstance() throws ParseException {
Options o = new Options().addOption("a", "apple", true, "Apples");
String[] args = { "-a", "one", "-a", "two" };
CommandLine c = new GnuParser().parse(o, args);
assertArrayEquals(new String[] { "one", "two" }, c
.getOptionValues("apple"));
assertEquals("one", c.getOptionValue("apple"));
}
Tuesday, May 18, 2010
Commons-CLI repeated options
I was curious about how repeated options are handled in commons-cli... Here is a test with the conclusion of that curiosity.
Labels:
programming
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment