List of usage examples for org.apache.commons.cli Option setArgName
public void setArgName(String argName)
From source file:com.buildml.main.commands.CliCommandShowActions.java
@Override public Options getOptions() { Options opts = new Options(); /* add the --show-pkgs option */ Option showPkgsOpt = new Option("p", "show-pkgs", false, "Show the package of each action."); opts.addOption(showPkgsOpt);/*w w w . ja va 2 s. c o m*/ /* add the -s/--short option */ Option shortOpt = new Option("s", "short", false, "Provide abbreviated output."); opts.addOption(shortOpt); /* add the -l/--long option */ Option longOpt = new Option("l", "long", false, "Provide detailed/long output."); opts.addOption(longOpt); /* add the -f/--filter option */ Option filterOpt = new Option("f", "filter", true, "Action-specs used to filter the output."); filterOpt.setArgName("action-spec:..."); opts.addOption(filterOpt); return opts; }
From source file:com.netscape.cmstools.pkcs12.PKCS12ExportCLI.java
public void createOptions() { Option option = new Option(null, "pkcs12-file", true, "PKCS #12 file"); option.setArgName("path"); options.addOption(option);/* w w w. j a va 2 s . c om*/ option = new Option(null, "pkcs12-password", true, "PKCS #12 password"); option.setArgName("password"); options.addOption(option); option = new Option(null, "pkcs12-password-file", true, "PKCS #12 password file"); option.setArgName("path"); options.addOption(option); option = new Option(null, "cert-encryption", true, "Certificate encryption algorithm (default: " + PKCS12Util.DEFAULT_CERT_ENCRYPTION_NAME + ")."); option.setArgName("algorithm"); options.addOption(option); option = new Option(null, "key-encryption", true, "Key encryption algorithm (default: " + PKCS12Util.DEFAULT_KEY_ENCRYPTION_NAME + ")."); option.setArgName("algorithm"); options.addOption(option); options.addOption(null, "append", false, "Append into an existing PKCS #12 file"); options.addOption(null, "no-trust-flags", false, "Do not include trust flags"); options.addOption(null, "no-key", false, "Do not include private key"); options.addOption(null, "no-chain", false, "Do not include certificate chain"); options.addOption("v", "verbose", false, "Run in verbose mode."); options.addOption(null, "debug", false, "Run in debug mode."); options.addOption(null, "help", false, "Show help message."); }
From source file:com.netscape.cmstools.pkcs12.PKCS12CertImportCLI.java
public void createOptions() { Option option = new Option(null, "pkcs12-file", true, "PKCS #12 file"); option.setArgName("path"); options.addOption(option);//from w w w . j a va 2s . com option = new Option(null, "pkcs12-password", true, "PKCS #12 password"); option.setArgName("password"); options.addOption(option); option = new Option(null, "pkcs12-password-file", true, "PKCS #12 password file"); option.setArgName("path"); options.addOption(option); option = new Option(null, "friendly-name", true, "Friendly name for the certificate in PKCS #12"); option.setArgName("name"); options.addOption(option); option = new Option(null, "cert-encryption", true, "Certificate encryption algorithm (default: " + PKCS12Util.DEFAULT_CERT_ENCRYPTION_NAME + ")."); option.setArgName("algorithm"); options.addOption(option); option = new Option(null, "key-encryption", true, "Key encryption algorithm (default: " + PKCS12Util.DEFAULT_KEY_ENCRYPTION_NAME + ")."); option.setArgName("algorithm"); options.addOption(option); options.addOption(null, "append", false, "Import into an existing PKCS #12 file"); options.addOption(null, "no-trust-flags", false, "Do not include trust flags"); options.addOption(null, "no-key", false, "Do not include private key"); options.addOption(null, "no-chain", false, "Do not include certificate chain"); options.addOption("v", "verbose", false, "Run in verbose mode."); options.addOption(null, "debug", false, "Run in debug mode."); options.addOption(null, "help", false, "Show help message."); }
From source file:com.tc.cli.CommandLineBuilder.java
public void addOption(String opt, String description, Class<?> type, boolean isRequired, String argName) { Option option = new Option(opt, description); option.setType(type);//w ww . j a va 2 s .c o m option.setRequired(isRequired); option.setArgName(argName); options.addOption(option); }
From source file:com.soulgalore.crawler.run.CrawlToFile.java
/** * Get the options./* www . ja v a 2 s . c o m*/ * * @return the specific CrawlToCsv options */ @Override protected Options getOptions() { final Options options = super.getOptions(); final Option filenameOption = new Option("f", "the name of the output file, default name is " + DEFAULT_FILENAME + " [optional]"); filenameOption.setArgName("FILENAME"); filenameOption.setLongOpt("filename"); filenameOption.setRequired(false); filenameOption.setArgs(1); options.addOption(filenameOption); final Option errorFilenameOption = new Option("ef", "the name of the error output file, default name is " + DEFAULT_ERROR_FILENAME + " [optional]"); errorFilenameOption.setArgName("ERRORFILENAME"); errorFilenameOption.setLongOpt("errorfilename"); errorFilenameOption.setRequired(false); errorFilenameOption.setArgs(1); options.addOption(errorFilenameOption); final Option verboseOption = new Option("ve", "verbose logging, default is false [optional]"); verboseOption.setArgName("VERBOSE"); verboseOption.setLongOpt("verbose"); verboseOption.setRequired(false); verboseOption.setArgs(1); verboseOption.setType(Boolean.class); options.addOption(verboseOption); return options; }
From source file:fr.inrialpes.exmo.align.cli.CommonCLI.java
public CommonCLI() { parameters = new Properties(); options = new Options(); options.addOption(createOption("h", "help", "Print this page")); options.addOption(createRequiredOption("o", "output", "Send output to FILE", "FILE")); options.addOption(createOptionalOption("d", "debug", "debug argument is deprecated, use logging instead\nSee http://alignapi.gforge.inria.fr/logging.html", "LEVEL")); options.addOption(createRequiredOption("P", "params", "Read parameters from FILE", "FILE")); // Special one Option opt = new Option("D", "Use value for given property"); opt.setArgs(2);//w w w .j a va 2s. co m opt.setValueSeparator('='); opt.setArgName("NAME=VALUE"); options.addOption(opt); }
From source file:com.tc.cli.CommandLineBuilder.java
public void addOption(String opt, boolean hasArg, String description, Class<?> type, boolean isRequired, String argName) {/*from ww w . ja v a 2 s . com*/ Option option = new Option(opt, hasArg, description); option.setType(type); option.setRequired(isRequired); option.setArgName(argName); options.addOption(option); }
From source file:edu.cornell.med.icb.geo.tools.GDS2InsightfulMiner.java
private void proccess(final String[] args) { // create the Options final Options options = new Options(); // help/* www . jav a2 s. co m*/ options.addOption("h", "help", false, "print this message"); // input file name final Option inputOption = new Option("i", "input", true, "specify a GEO data set file (GDS file)"); inputOption.setArgName("file"); inputOption.setRequired(true); options.addOption(inputOption); // output file name final Option outputOption = new Option("o", "output", true, "specify the destination file"); outputOption.setArgName("file"); outputOption.setRequired(true); options.addOption(outputOption); // label values final Option labelOptions = new Option("l", "label", true, "specify a label to tag a set of columns"); labelOptions.setArgName("double-value"); labelOptions.setRequired(false); options.addOption(labelOptions); // group file names final Option groupOptions = new Option("g", "group", true, "specify a file that named columns associated to a label. Each -group option must match a -label option. Matching is done according to the order on the command line. Each line of the group file identifies a column in the GEO data set that is to be labeled according to the corresponding label"); groupOptions.setArgName("file"); groupOptions.setRequired(false); options.addOption(groupOptions); // default label value final Option defaultLabelOption = new Option("dl", "default-label", true, "Specify the label to use for columns that are not identified by -l -g pairs. Default value is zero."); groupOptions.setArgName("double-value"); groupOptions.setRequired(false); options.addOption(defaultLabelOption); // parse the command line arguments CommandLine line = null; double defaultLabelValue = 0; try { // create the command line parser final CommandLineParser parser = new BasicParser(); line = parser.parse(options, args, true); if ((line.hasOption("l") && !line.hasOption("g")) || (line.hasOption("g") && !line.hasOption("l"))) { System.err.println("Options -label and -group must be used together."); System.exit(10); } if (line.hasOption("l") && line.getOptionValues("l").length != line.getOptionValues("g").length) { System.err.println("The number of -label and -group options must match exactly."); System.exit(10); } if (line.hasOption("dl")) { defaultLabelValue = Double.parseDouble(line.getOptionValue("dl")); } } catch (ParseException e) { System.err.println(e.getMessage()); usage(options); System.exit(1); } // print help and exit if (line.hasOption("h")) { usage(options); System.exit(0); } try { final Map<Double, Set<String>> labels = readLabelGroups(line.getOptionValues("l"), line.getOptionValues("g")); //labels convert(line.getOptionValue("i"), line.getOptionValue("o"), labels, defaultLabelValue); System.exit(0); } catch (FileNotFoundException e) { System.err.println("Error opening file: \n"); printGroups(line); } catch (IOException e) { System.err.println("An error occurred reading one of the group files:\n"); printGroups(line); } }
From source file:com.netscape.cmstools.ca.CACertRequestFindCLI.java
public void createOptions() { Option option = null; // request state option = new Option(null, "status", true, "Request status (pending, cancelled, rejected, complete, all)"); option.setArgName("status"); options.addOption(option);//w ww . ja va 2 s . com // request type option = new Option(null, "type", true, "Request type (enrollment, renewal, revocation, all)"); option.setArgName("type"); options.addOption(option); //pagination options option = new Option(null, "start", true, "Page start"); option.setArgName("start"); options.addOption(option); option = new Option(null, "size", true, "Page size"); option.setArgName("size"); options.addOption(option); //search limits option = new Option(null, "maxResults", true, "Maximum number of results"); option.setArgName("maxResults"); options.addOption(option); option = new Option(null, "timeout", true, "Search timeout"); option.setArgName("maxTime"); options.addOption(option); }
From source file:com.tc.cli.CommandLineBuilder.java
public void addOption(String opt, String longOpt, boolean hasArg, String description, Class<?> type, boolean isRequired, String argName) { Option option = new Option(opt, longOpt, hasArg, description); option.setType(type);// www .j a v a 2 s. c om option.setRequired(isRequired); option.setArgName(argName); options.addOption(option); }