• Home
  • Raw
  • Download

Lines Matching +full:- +full:- +full:long +full:- +full:file +full:- +full:names

6 :source-highlighter: prettify
11 <div style="display:inline-block">
12 <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
19 <input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_LG.gif:NonHostedGuest">
20 …cts.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier wa…
36 ----
43 @Parameter(names = { "-log", "-verbose" }, description = "Level of verbosity")
46 @Parameter(names = "-groups", description = "Comma-separated list of group names to be run")
49 @Parameter(names = "-debug", description = "Debug mode")
52 ----
57 ----
59 String[] argv = { "-log", "2", "-groups", "unit" };
66 ----
71 ----
73 @Parameter(names={"--length", "-l"})
75 @Parameter(names={"--pattern", "-p"})
91 ----
94 ----
95 $ java Main -l 512 --pattern 2
97 ----
102 … supported by default and you can write type converters to support any other type (`File`, etc...).
109 ----
110 @Parameter(names = "-debug", description = "Debug mode")
112 ----
117 ----
118 @Parameter(names = "-debug", description = "Debug mode", arity = 1)
120 ----
125 ----
126 program -debug true
127 program -debug false
128 ----
130 When a Parameter annotation is found on a field of type `String`, `Integer`, `int`, `Long` or `long
133 ----
134 @Parameter(names = "-log", description = "Level of verbosity")
136 ----
139 ----
140 java Main -log 3
141 ----
146 ----
147 $ java Main -log test
148 ----
157 ----
158 @Parameter(names = "-host", description = "The host")
160 ----
165 ----
166 $ java Main -host host1 -verbose -host host2
167 ----
176 ----
178 @Parameter(names = "-password", description = "Connection password", password = true)
181 ----
186 ----
187 Value for -password (Connection password):
188 ----
197 ----
199 …@Parameter(names = "-password", description = "Connection password", password = true, echoInput = …
202 ----
209 [[single-value]]
210 === Custom types - Single value
216 …, your application actually needs more complex types (such as files, host names, lists, etc.). To …
219 ----
223 ----
225 For example, here is a converter that turns a string into a File:
228 ----
229 public class FileConverter implements IStringConverter<File> {
231 public File convert(String value) {
232 return new File(value);
235 ----
240 ----
241 @Parameter(names = "-file", converter = FileConverter.class)
242 File file;
243 ----
252 ----
253 @Parameter(names = "-files", converter = FileConverter.class)
254 List<File> files;
255 ----
260 ----
261 $ java App -files file1,file2,file3
262 ----
266 For an alternative solution to parse a list of values, see <<list-value>>.
273 ----
277 ----
282 ----
283 $ java App -target example.com:8080
284 ----
289 ----
299 ----
304 ----
312 ----
317 ----
323 ----
328 ----
330 @Parameter(names = "-hostport")
333 ----
338 ----
344 .parse("-hostport", "example.com:8080");
348 ----
352 [[list-value]]
353 === Custom types - List value
362 ----
366 ----
370 For example, here is a list converter that turns a string into a `List<File>`:
373 ----
374 public class FileListConverter implements IStringConverter<List<File>> {
376 public List<File> convert(String files) {
378 List<File> fileList = new ArrayList<>();
380 fileList.add(new File(path));
385 ----
390 ----
391 @Parameter(names = "-files", listConverter = FileListConverter.class)
392 List<File> file;
393 ----
398 ----
399 $ java App -files file1,file2,file3
400 ----
409 …ssign a custom `IParameterSplitter` implementation to handle how parameters are split in sub-parts.
418 ----
422 ----
427 ----
433 ----
438 ----
439 @Parameter(names = "-files", converter = FileConverter.class, splitter = SemiColonSplitter.class)
440 List<File> files;
441 ----
455 ----
460 * @param name The name of the parameter (e.g. "-host").
467 ----
472 ----
482 ----
487 ----
488 @Parameter(names = "-age", validateWith = PositiveInteger.class)
490 ----
497 ----
498 @Parameter(names = "-count", validateWith = { PositiveInteger.class, CustomOddNumberValidator.class…
500 ----
505 …ions involved in such validation, JCommander does not provide any annotation-based solution to per…
510 So far, all the `@Parameter` annotations we have seen had defined an attribute called `names`. You …
513 ----
517 @Parameter(names = "-debug", description = "Debugging level")
519 ----
524 ----
525 $ java Main -debug file1 file2
526 ----
535 ----
537 @Parameter(names = "-verbose")
548 .parse("-verbose", "3");
550 ----
557 ----
558 $ java Main -log:3
559 ----
564 ----
565 $ java Main -level=42
566 ----
571 ----
574 @Parameter(names = "-level")
577 ----
584 ----
586 @Parameter(names = "-master")
591 @Parameter(names = "-slave")
594 ----
599 ----
602 String[] argv = { "-master", "master", "-slave", "slave" };
610 ----
614 …ts the @ syntax, which allows you to put all your options into a file and pass this file as parame…
616 [[app-listing]]
619 ----
620 -verbose
624 ----
627 ----
629 ----
635 …uire more than one value, such as the following example where two values are expected after -pairs:
638 ----
639 $ java Main -pairs slave master foo.xml
640 ----
645 ----
646 @Parameter(names = "-pairs", arity = 2, description = "Pairs")
648 ----
650 …have a default arity of 0) and of types `String`, `Integer`, `int`, `Long` and `long` (which have …
659 ----
660 program -foo a1 a2 a3 -bar
661 program -foo a1 -bar
662 ----
672 ----
673 @Parameter(names = "-foo", variableArity = true)
675 ----
683 ----
695 @Parameter(names = {"--mv"}, arity = 2)
702 .args(new String[]{"--mv", "from", "to"})
709 ----
711 == Multiple option names
715 ----
716 @Parameter(names = { "-d", "--outputDirectory" }, description = "Directory")
718 ----
723 ----
724 $ java Main -d /tmp
725 $ java Main --outputDirectory /tmp
726 ----
732 - `JCommander#setCaseSensitiveOptions(boolean)`: specify whether options are case sensitive. If you…
733 - `JCommander#setAllowAbbreviatedOptions(boolean)`: specify whether users can pass abbreviated opti…
740 ----
741 @Parameter(names = "-host", required = true)
743 ----
752 ----
754 ----
756 …efault values in a centralized location such as a `.properties` or an XML file. In this case, you …
759 ----
762 * @param optionName The name of the option as specified in the names() attribute
763 * of the @Parameter option (e.g. "-file").
769 ----
773 … default provider that will assign a default value of 42 for all your parameters except `"-debug"`:
776 ----
780 return "-debug".equals(optionName) ? "false" : "42";
791 ----
799 ----
800 @Parameter(names = "--help", help = true)
802 ----
811 ----
812 $ git commit --amend -m "Bug fix"
813 ----
818 ----
825 @Parameter(names = "--amend", description = "Amend")
828 @Parameter(names = "--author")
832 @Parameters(commandDescription = "Add file contents to the index")
835 @Parameter(description = "File patterns to add to the index")
838 @Parameter(names = "-i")
841 ----
846 ----
856 jc.parse("-v", "commit", "--amend", "--author=cbeust", "A.java", "B.java");
863 ----
875 ----
878 -debug Debug mode (default: false)
879 -groups Comma-separated list of group names to be run
880 * -log, -verbose Level of verbosity (default: 1)
881 -long A long number (default: 0)
882 ----
889 ----
891 @Parameter(names = "--importantOption", order = 0)
894 @Parameter(names = "--lessImportantOption", order = 3)
896 ----
903 ----
904 @Parameter(names = "-debug", description = "Debug mode", hidden = true)
906 ----
914 ----
917 @Parameter(names = "-host", description = "Host", descriptionKey = "host")
920 ----
925 ----
927 ----
938 ----
940 @Parameter(names = "-port")
945 @Parameter(names = "-v")
951 ----
957 ----
960 .parse("-v", "-port", "1234");
963 ----
967 JCommander allows you to specify parameters that are not known at compile time, such as "-Da=b -Dc=…
970 ----
971 @DynamicParameter(names = "-D", description = "Dynamic parameters go here")
973 ----
982 ----
987 @Parameter(names = arrayOf("-bf", "--buildFile"), description = "The build file")
990 @Parameter(names = arrayOf("--checkVersions"),
994 ----
1001 ----
1005 …@Parameter(names = ["-f", "--file"], description = "File to load. Can be specified multiple times.…
1006 List<String> file
1011 file.each { println "file: ${new File(it).name}" }
1013 ----
1019 - https://github.com/cbeust/testng/blob/master/src/main/java/org/testng/CommandLineArgs.java[TestNG]
1020 - https://github.com/cbeust/kobalt/blob/master/modules/kobalt-plugin-api/src/main/kotlin/com/beust/…
1038 - http://github.com/cbeust/jcommander[Source on github]
1039 - Kobalt
1042 ----
1044 ----
1046 - Gradle
1049 ----
1051 ----
1053 - Maven:
1056 ----
1062 ----