List of usage examples for org.apache.commons.cli PatternOptionBuilder EXISTING_FILE_VALUE
Class EXISTING_FILE_VALUE
To view the source code for org.apache.commons.cli PatternOptionBuilder EXISTING_FILE_VALUE.
Click Source Link
From source file:org.dcm4che.tool.dcm2jpg.Dcm2Jpg.java
@SuppressWarnings("static-access") private static CommandLine parseComandLine(String[] args) throws ParseException { Options opts = new Options(); CLIUtils.addCommonOptions(opts);//from w ww . j av a 2s.c o m opts.addOption( OptionBuilder.hasArg().withArgName("format").withDescription(rb.getString("format")).create("F")); opts.addOption( OptionBuilder.hasArg().withArgName("class").withDescription(rb.getString("encoder")).create("E")); opts.addOption(OptionBuilder.hasArg().withArgName("type").withDescription(rb.getString("compression")) .create("C")); opts.addOption(OptionBuilder.hasArg().withArgName("quality").withType(PatternOptionBuilder.NUMBER_VALUE) .withDescription(rb.getString("quality")).create("q")); opts.addOption(OptionBuilder.hasArg().withArgName("suffix").withDescription(rb.getString("suffix")) .withLongOpt("suffix").create()); opts.addOption(OptionBuilder.hasArg().withArgName("number").withType(PatternOptionBuilder.NUMBER_VALUE) .withDescription(rb.getString("frame")).withLongOpt("frame").create()); opts.addOption(OptionBuilder.hasArg().withArgName("center").withType(PatternOptionBuilder.NUMBER_VALUE) .withDescription(rb.getString("windowCenter")).withLongOpt("windowCenter").create("c")); opts.addOption(OptionBuilder.hasArg().withArgName("width").withType(PatternOptionBuilder.NUMBER_VALUE) .withDescription(rb.getString("windowWidth")).withLongOpt("windowWidth").create("w")); opts.addOption(OptionBuilder.hasArg().withArgName("number").withType(PatternOptionBuilder.NUMBER_VALUE) .withDescription(rb.getString("window")).withLongOpt("window").create()); opts.addOption(OptionBuilder.hasArg().withArgName("number").withType(PatternOptionBuilder.NUMBER_VALUE) .withDescription(rb.getString("voilut")).withLongOpt("voilut").create()); opts.addOption(OptionBuilder.hasArg().withArgName("file").withType(PatternOptionBuilder.EXISTING_FILE_VALUE) .withDescription(rb.getString("ps")).withLongOpt("ps").create()); opts.addOption(OptionBuilder.hasArg().withArgName("mask").withDescription(rb.getString("overlays")) .withLongOpt("overlays").create()); opts.addOption(OptionBuilder.hasArg().withArgName("value").withDescription(rb.getString("ovlygray")) .withLongOpt("ovlygray").create()); opts.addOption(null, "uselut", false, rb.getString("uselut")); opts.addOption(null, "noauto", false, rb.getString("noauto")); opts.addOption(null, "lsE", false, rb.getString("lsencoders")); opts.addOption(null, "lsF", false, rb.getString("lsformats")); CommandLine cl = CLIUtils.parseComandLine(args, opts, rb, Dcm2Jpg.class); if (cl.hasOption("lsF")) { listSupportedFormats(); System.exit(0); } if (cl.hasOption("lsE")) { listSupportedImageWriters(cl.getOptionValue("F", "JPEG")); System.exit(0); } return cl; }