Hi Benedikt, https://issues.apache.org/jira/browse/CLI-255
Thank you. Alex P. On Mon, Jun 22, 2015 at 2:24 PM, Benedikt Ritter <brit...@apache.org> wrote: > Hello Alex, > > can you please file an issue at https://issues.apache.org/jira/browse/CLI > ? > > Thank you! > > > 2015-06-18 0:02 GMT+02:00 Alex P <student...@gmail.com>: > >> Hi All, >> >> Not sure if that is a change in API or bug in DefaultParser. >> >> If I use GnuParser (what I used in 1.2) like: >> ------------------------------------------------------------- >> public void testUnlimitedArgs() throws Exception >> { >> String[] args = new String[] {"-unlimited", "one", "two", "-one", >> "alpha"}; >> >> Options options = new Options(); >> options.addOption(Option.builder("one").hasArg().build()); >> options.addOption(Option.builder("unlimited").hasArgs().build()); >> >> CommandLine cl = parser.parse(options, args); >> >> assertTrue("Confirm -unlimited is set", >> cl.hasOption("unlimited")); >> assertEquals("number of arg for -unlimited", 2, >> cl.getOptionValues("unlimited").length); >> assertTrue("Confirm -one is set", cl.hasOption("one")); >> assertEquals("number of arg for -one", 1, >> cl.getOptionValues("one").length); >> } >> ------------------------------------------------------------- >> everything works fine. >> >> But in 1.3 GnuParser is deprecated and if I do the same options with >> DefaultParser, it becomes dependent on arguments position - my original >> line fails, but if I change it to >> ------------------------------------------------------------- >> String[] args = new String[] {"-one", "alpha", "-unlimited", >> "one", >> "two"}; >> ------------------------------------------------------------- >> test succeed. >> >> Any thoughts? >> >> Regards, >> AlexP. >> > > > > -- > http://people.apache.org/~britter/ > http://www.systemoutprintln.de/ > http://twitter.com/BenediktRitter > http://github.com/britter >