From bb73fda634685379a8e99565f42b0ad47ac9bace Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Wed, 14 Jan 2015 15:45:07 -0800 Subject: Doc update. --- doc/index.html | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/doc/index.html b/doc/index.html index 8ee8880..6d67768 100644 --- a/doc/index.html +++ b/doc/index.html @@ -52,7 +52,7 @@ - Last updated: August 2nd, 2014 + Last updated: January 14th, 2015 Cédric Beust @@ -808,9 +808,25 @@ object Main { } +

JCommander in Groovy

+ +
+import com.beust.jcommander.*
+
+class Args {
+  @Parameter(names = ["-f", "--file"], description = "File to load. Can be specified multiple times.")
+  List<String> file
+}
+
+new Args().with {
+  new JCommander(it, args)
+  file.each { println "file: ${new File(it).name}" }
+}
+
+

More examples

-TestNG uses JCommander to parse its command line, here is its definition file. +TestNG uses JCommander to parse its own command line, here is its definition file.

Mailing list

-- cgit v1.2.3