summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorCedric Beust <cedric@beust.com>2010-07-23 15:25:41 -0700
committerCedric Beust <cedric@beust.com>2010-07-23 15:25:41 -0700
commit057d3653da7c514f8bb86a69f8e29f99d27b688d (patch)
tree2240704694ea20368db950f0a2fa10a16eba6b46 /doc
parentfe9b1e59d132e6b10819ae8c9dc3300fb3200ae0 (diff)
downloadplatform_external_jcommander-057d3653da7c514f8bb86a69f8e29f99d27b688d.tar.gz
platform_external_jcommander-057d3653da7c514f8bb86a69f8e29f99d27b688d.tar.bz2
platform_external_jcommander-057d3653da7c514f8bb86a69f8e29f99d27b688d.zip
Documented separators and @Parameters
Diffstat (limited to 'doc')
-rw-r--r--doc/index.html31
1 files changed, 29 insertions, 2 deletions
diff --git a/doc/index.html b/doc/index.html
index d872d22..1982643 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -215,6 +215,33 @@ new JCommander(args, "-verbose", "3");
Assert.assertEquals(args.getVerbose().intValue(), 3);
</pre>
+<h2 id="Separators">Parameter separators</h2>
+
+By default, parameters are separated by spaces, but you can change this setting to allow different separators:
+
+<pre class="brush: bash">
+java Main -log:3
+</pre>
+
+or
+
+<pre class="brush: bash">
+java Main -level=42
+</pre>
+
+You define the separator with the <tt>@Parameters</tt> annotation:
+
+<pre class="brush: java">
+@Parameters(separators = "=")
+public class SeparatorEqual {
+ @Parameter(names = "-level")
+ public Integer level = 2;
+}
+</pre>
+
+
+
+
<h2 id="Multiple_descriptions">Multiple descriptions</h2>
@@ -365,11 +392,11 @@ You can internationalize the descriptions of your parameters.
<p>
-First you use the <tt>@ResourceBundle</tt> annotation at the top of your class to define the name of your message bundle, and then you use the <tt>descriptionKey</tt> attribute instead of <tt>description</tt> on all the <tt>@Parameters</tt> that require translations. This <tt>descriptionKey</tt> is the key to the string into your message bundle:
+First you use the <tt>@Parameters</tt> annotation at the top of your class to define the name of your message bundle, and then you use the <tt>descriptionKey</tt> attribute instead of <tt>description</tt> on all the <tt>@Parameters</tt> that require translations. This <tt>descriptionKey</tt> is the key to the string into your message bundle:
<h3 class="sourcetitle">I18N.java</h3>
<pre class="brush:java">
-@ResourceBundle("MessageBundle")
+@Parameters(resourceBundle = "MessageBundle")
public class ArgsI18N2 {
@Parameter(names = "-host", description = "Host", descriptionKey = "host")
String hostName;