• Home
Name Date Size #Lines LOC

..--

doc/03-May-2024-872624

src/03-May-2024-8,6745,003

.gitignoreD03-May-202491 76

Android.bpD03-May-20241.2 KiB4136

CHANGELOGD03-May-20245.1 KiB140106

METADATAD03-May-2024415 1918

MODULE_LICENSE_APACHE2D03-May-20240

NOTICED03-May-202411.1 KiB204169

OWNERSD03-May-202448 32

README.markdownD03-May-20241.3 KiB4431

README.versionD03-May-2024131 54

build-with-mavenD03-May-2024750 1711

license.txtD03-May-202411.1 KiB204169

notice.mdD03-May-2024108 63

pom.xmlD03-May-20248.8 KiB284227

releaseD03-May-2024292 96

uploadD03-May-2024192 63

README.markdown

1JCommander
2==========
3
4This is an annotation based parameter parsing framework for Java.
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://beust.com/jcommander
44

README.version

1URL: https://github.com/cbeust/jcommander
2Version: 1.48 (14fbe2bc5a2c402b456ed68578a5d5dc2c343fa2)
3BugComponent: 99142
4Owners: iam
5