Description
With the sample program below, running with the arguments
-a 0 -b 1 2 3 4
causes the error:
Unexpected 3 while processing options
Usage:
[-a <a1> [<a2> ...] -b <b1> <b2> [<b3> [<b4>]]]
options
a (-a) a [a ...]
b (-b) b b [b [b]]
I specified .withMinimum(2).withMaximum(4)
The help is correct, but the value '3' is not added as a value.
Note also that if for bOption, if you add two more defaults (uncomment them in the source)
.withDefault("10000")
.withDefault("1000000")
an error is raised (incorrectly) on the first b value (i.e. 1 instead of 3) :
Unexpected 1 while processing options
Usage:
[-a <a1> [<a2> ...] -b <b1> <b2> [<b3> [<b4>]]]
options
a (-a) a [a ...]
b (-b) b b [b [b]]
Source:
package org.apache.commons.cli2.issues;
import java.util.List;
import org.apache.commons.cli2.CommandLine;
import org.apache.commons.cli2.Group;
import org.apache.commons.cli2.builder.ArgumentBuilder;
import org.apache.commons.cli2.builder.DefaultOptionBuilder;
import org.apache.commons.cli2.builder.GroupBuilder;
import org.apache.commons.cli2.commandline.Parser;
import org.apache.commons.cli2.option.DefaultOption;
public class WithMinimum
{
public static void main(String[] args)
}