diff options
author | John Yani <vanuan@gmail.com> | 2012-10-25 12:33:30 +0300 |
---|---|---|
committer | John Yani <vanuan@gmail.com> | 2012-10-25 12:33:30 +0300 |
commit | c55dc01a3d8c54dc5711860e6e649d4cb9ba70e8 (patch) | |
tree | ae9bbb3c3fe93ae4c7f2cbd04ec91c3b29111485 /README.markdown | |
parent | 5fc805c44e904eb37f24217676b5da1619268c48 (diff) | |
download | jcommander-c55dc01a3d8c54dc5711860e6e649d4cb9ba70e8.tar.gz |
Update README.markdown
Add a DynamicParameter.
Swap expected and actual in assertion.
Make a -groups option more clear.
Show where parameters are stored.
Diffstat (limited to 'README.markdown')
-rw-r--r-- | README.markdown | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/README.markdown b/README.markdown index bf479db..048bc39 100644 --- a/README.markdown +++ b/README.markdown @@ -18,6 +18,10 @@ public class JCommanderTest { @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>(); + } ``` @@ -25,10 +29,19 @@ and how you use it: ```java CommanderTest jct = new JCommanderTest(); -String[] argv = { "-log", "2", "-groups", "unit", "a", "b", "c" }; +String[] argv = { "-log", "2", "-groups", "unit1,unit2,unit3", + "-Doption=value", "a", "b", "c" }; new JCommander(jct, argv); -Assert.assertEquals(jct.verbose.intValue(), 2); +Assert.assertEquals(2, jct.verbose.intValue()); + +Assert.assertEquals("unit1,unit2,unit3", jct.groups); + +Map<String, String> params = new HashMap<String, String>(); +params.put("option", "value"); +Assert.assertEquals(params, jct.params); + +Assert.assertEquals(Arrays.asList("a", "b", "c"), jct.parameters); ``` The full doc is available at http://beust.com/jcommander |