• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

doc/23-Nov-2023-5,4934,141

gradle/23-Nov-2023-7159

kobalt/23-Nov-2023-6151

src/23-Nov-2023-10,2726,158

.gitignoreD23-Nov-2023227 2422

.travis.ymlD23-Nov-2023128 127

Android.bpD23-Nov-20232.5 KiB7770

CHANGELOG.mdD23-Nov-20238.1 KiB210160

LICENSED23-Nov-202311.1 KiB204169

METADATAD23-Nov-2023401 2019

MODULE_LICENSE_APACHE2D23-Nov-20230

OWNERSD23-Nov-202348 32

README.markdownD23-Nov-20231.3 KiB5135

build.gradleD23-Nov-2023712 4536

gradlewD23-Nov-20235 KiB165122

kobaltwD23-Nov-202382 31

license.txtD23-Nov-202311.1 KiB204169

misc.xmlD23-Nov-2023250 44

notice.mdD23-Nov-2023108 63

releaseD23-Nov-2023292 96

uploadD23-Nov-2023192 63

README.markdown

1JCommander
2==========
3
4This is an annotation based parameter parsing framework for Java 8.
5
6Here is a quick example:
7
8```java
9public class JCommanderTest {
10    @Parameter
11    public List<String> parameters = Lists.newArrayList();
12
13    @Parameter(names = { "-log", "-verbose" }, description = "Level of verbosity")
14    public Integer verbose = 1;
15
16    @Parameter(names = "-groups", description = "Comma-separated list of group names to be run")
17    public String groups;
18
19    @Parameter(names = "-debug", description = "Debug mode")
20    public boolean debug = false;
21
22    @DynamicParameter(names = "-D", description = "Dynamic parameters go here")
23    public Map<String, String> dynamicParams = new HashMap<String, String>();
24
25}
26```
27
28and how you use it:
29
30```java
31JCommanderTest jct = new JCommanderTest();
32String[] argv = { "-log", "2", "-groups", "unit1,unit2,unit3",
33                    "-debug", "-Doption=value", "a", "b", "c" };
34new JCommander(jct, argv);
35
36Assert.assertEquals(2, jct.verbose.intValue());
37Assert.assertEquals("unit1,unit2,unit3", jct.groups);
38Assert.assertEquals(true, jct.debug);
39Assert.assertEquals("value", jct.dynamicParams.get("option"));
40Assert.assertEquals(Arrays.asList("a", "b", "c"), jct.parameters);
41```
42
43The full doc is available at [http://jcommander.org](http://jcommander.org).
44
45## Building JCommander
46
47```
48./kobaltw assemble
49```
50
51