You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jianglk.darker 7ee447c011
v811_spc009_project
4 months ago
..
doc v811_spc009_project 4 months ago
gradle v811_spc009_project 4 months ago
kobalt v811_spc009_project 4 months ago
lib v811_spc009_project 4 months ago
src v811_spc009_project 4 months ago
.travis.yml v811_spc009_project 4 months ago
Android.bp v811_spc009_project 4 months ago
CHANGELOG.md v811_spc009_project 4 months ago
LICENSE v811_spc009_project 4 months ago
METADATA v811_spc009_project 4 months ago
MODULE_LICENSE_APACHE2 v811_spc009_project 4 months ago
OWNERS v811_spc009_project 4 months ago
README.markdown v811_spc009_project 4 months ago
build.gradle v811_spc009_project 4 months ago
gradlew v811_spc009_project 4 months ago
kobaltw v811_spc009_project 4 months ago
license.txt v811_spc009_project 4 months ago
misc.xml v811_spc009_project 4 months ago
notice.md v811_spc009_project 4 months ago
release v811_spc009_project 4 months ago
upload v811_spc009_project 4 months ago

README.markdown

JCommander

This is an annotation based parameter parsing framework for Java 8.

Here is a quick example:

public class JCommanderTest {
    @Parameter
    public List<String> parameters = Lists.newArrayList();
 
    @Parameter(names = { "-log", "-verbose" }, description = "Level of verbosity")
    public Integer verbose = 1;
 
    @Parameter(names = "-groups", description = "Comma-separated list of group names to be run")
    public String groups;
 
    @Parameter(names = "-debug", description = "Debug mode")
    public boolean debug = false;

    @DynamicParameter(names = "-D", description = "Dynamic parameters go here")
    public Map<String, String> dynamicParams = new HashMap<String, String>();

}

and how you use it:

JCommanderTest jct = new JCommanderTest();
String[] argv = { "-log", "2", "-groups", "unit1,unit2,unit3",
                    "-debug", "-Doption=value", "a", "b", "c" };
new JCommander(jct, argv);

Assert.assertEquals(2, jct.verbose.intValue());
Assert.assertEquals("unit1,unit2,unit3", jct.groups);
Assert.assertEquals(true, jct.debug);
Assert.assertEquals("value", jct.dynamicParams.get("option"));
Assert.assertEquals(Arrays.asList("a", "b", "c"), jct.parameters);

The full doc is available at http://jcommander.org.

Building JCommander

./kobaltw assemble