List of usage examples for org.apache.commons.cli Option setArgName
public void setArgName(String argName)
From source file:com.linkedin.helix.webapp.RestAdminApplication.java
@SuppressWarnings("static-access") private static Options constructCommandLineOptions() { Option helpOption = OptionBuilder.withLongOpt(HELP).withDescription("Prints command-line options info") .create();// www . jav a2 s.c om helpOption.setArgs(0); helpOption.setRequired(false); helpOption.setArgName("print help message"); Option zkServerOption = OptionBuilder.withLongOpt(ZKSERVERADDRESS) .withDescription("Provide zookeeper address").create(); zkServerOption.setArgs(1); zkServerOption.setRequired(true); zkServerOption.setArgName("ZookeeperServerAddress(Required)"); Option portOption = OptionBuilder.withLongOpt(PORT).withDescription("Provide web service port").create(); portOption.setArgs(1); portOption.setRequired(false); portOption.setArgName("web service port, default: " + DEFAULT_PORT); Options options = new Options(); options.addOption(helpOption); options.addOption(zkServerOption); options.addOption(portOption); return options; }
From source file:com.opengamma.integration.tool.marketdata.MarketDataSnapshotTool.java
private static Option createValuationTimeOption() { final Option option = new Option(VALUATION_TIME_OPTION, "valuationTime", true, "the valuation time, HH:mm[:ss] (defaults to now)"); option.setArgName("valuation time"); return option; }
From source file:Dcm2Txt.java
private static CommandLine parse(String[] args) { Options opts = new Options(); Option width = new Option("w", "width", true, "maximal number of characters per line, by default: 80"); width.setArgName("max"); opts.addOption(width);//from w w w. ja v a2 s. c o m Option vallen = new Option("l", "vallen", true, "limit value prompt to <maxlen> characters, by default: 64"); vallen.setArgName("max"); opts.addOption(vallen); opts.addOption("c", "compact", false, "dump without attribute names"); opts.addOption("h", "help", false, "print this message"); opts.addOption("V", "version", false, "print the version information and exit"); CommandLine cl = null; try { cl = new PosixParser().parse(opts, args); } catch (ParseException e) { exit("dcm2txt: " + e.getMessage()); throw new RuntimeException("unreachable"); } if (cl.hasOption('V')) { Package p = Dcm2Txt.class.getPackage(); System.out.println("dcm2txt v" + p.getImplementationVersion()); System.exit(0); } if (cl.hasOption('h') || cl.getArgList().isEmpty()) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(USAGE, DESCRIPTION, opts, EXAMPLE); System.exit(0); } return cl; }
From source file:com.pinterest.rocksplicator.Participant.java
private static Options constructCommandLineOptions() { Option zkServerOption = OptionBuilder.withLongOpt(zkServer).withDescription("Provide zookeeper addresses") .create();//www . j av a 2s .com zkServerOption.setArgs(1); zkServerOption.setRequired(true); zkServerOption.setArgName("ZookeeperServerAddresses(Required)"); Option clusterOption = OptionBuilder.withLongOpt(cluster).withDescription("Provide cluster name").create(); clusterOption.setArgs(1); clusterOption.setRequired(true); clusterOption.setArgName("Cluster name (Required)"); Option domainOption = OptionBuilder.withLongOpt(domain).withDescription("Provide instance domain").create(); domainOption.setArgs(1); domainOption.setRequired(true); domainOption.setArgName("Instance domain (Required)"); Option hostOption = OptionBuilder.withLongOpt(hostAddress).withDescription("Provide host name").create(); hostOption.setArgs(1); hostOption.setRequired(true); hostOption.setArgName("Host name (Required)"); Option portOption = OptionBuilder.withLongOpt(hostPort).withDescription("Provide host port").create(); portOption.setArgs(1); portOption.setRequired(true); portOption.setArgName("Host port (Required)"); Option stateModelOption = OptionBuilder.withLongOpt(stateModel).withDescription("StateModel Type").create(); stateModelOption.setArgs(1); stateModelOption.setRequired(true); stateModelOption.setArgName("StateModel Type (Required)"); Option configPostUrlOption = OptionBuilder.withLongOpt(configPostUrl).withDescription("URL to post config") .create(); configPostUrlOption.setArgs(1); configPostUrlOption.setRequired(true); configPostUrlOption.setArgName("URL to post config (Required)"); Options options = new Options(); options.addOption(zkServerOption).addOption(clusterOption).addOption(domainOption).addOption(hostOption) .addOption(portOption).addOption(stateModelOption).addOption(configPostUrlOption); return options; }
From source file:com.opengamma.component.tool.AbstractDbTool.java
private static Option createOutputFileOption() { Option option = new Option(OUTPUT_FILE_OPTION, "output", true, "a file to which the SQL should be output"); option.setArgName("file"); option.setRequired(false);// w ww . ja v a 2 s .c o m return option; }
From source file:com.netscape.cmstools.CMCSharedToken.java
public static Options createOptions() { Options options = new Options(); Option option = new Option("d", true, "Security database location"); option.setArgName("database"); options.addOption(option);//from w w w . j a v a 2 s .c om option = new Option("h", true, "Security token name"); option.setArgName("token"); options.addOption(option); option = new Option("o", true, "Output file to store base-64 secret data"); option.setArgName("output"); options.addOption(option); option = new Option("p", true, "password"); option.setArgName("password"); options.addOption(option); option = new Option("s", true, "passphrase"); option.setArgName("passphrase"); options.addOption(option); option = new Option("b", true, "PEM issuance protection certificate"); option.setArgName("issuance protection cert"); options.addOption(option); option = new Option("n", true, "Issuance Protection certificate nickname"); option.setArgName("issuance protection cert nickname"); options.addOption(option); options.addOption("v", "verbose", false, "Run in verbose mode."); options.addOption(null, "help", false, "Show help message."); return options; }
From source file:com.opengamma.component.tool.AbstractComponentTool.java
private static Option createLogbackOption() { Option option = new Option(LOGBACK_RESOURCE_OPTION, "logback", true, "the logback configuration resource"); option.setArgName("resource"); option.setRequired(false);/* w w w. j a v a 2s .c o m*/ return option; }
From source file:Generate.java
private static void optionSetup() { options = new Options(); Option help = new Option("h", "help", false, "print usage of Pyjama compiler"); help.setRequired(false);/*from w w w. j a va 2 s . c o m*/ options.addOption(help); Option classpath = new Option("cp", "classpath", true, "Specify where to find user class files and annotation processors"); classpath.setRequired(false); classpath.setArgs(1); classpath.setArgName("PATH"); options.addOption(classpath); Option outputPath = new Option("d", "directory", true, "output file directory"); outputPath.setRequired(false); outputPath.setArgs(1); outputPath.setArgName("DIR"); options.addOption(outputPath); Option j2c = new Option("j2c", "javatoclass", false, "(default)compile .java file to paralleled .class file"); j2c.setRequired(false); options.addOption(j2c); Option j2j = new Option("j2j", "javatojava", false, "compile .java file to paralleled .java file. " + "Remember new parallel java file will overwrite old sequential java file, " + "if there is no target directory is specified."); j2j.setRequired(false); options.addOption(j2j); Option p2c = new Option("p2c", "pjtoclass", false, "compile .pj file to paralleled .class file"); p2c.setRequired(false); options.addOption(p2c); Option p2j = new Option("p2j", "pjtojava", false, "compile .pj file to paralleled .java file"); p2j.setRequired(false); options.addOption(p2j); }
From source file:com.bc.fiduceo.ingest.IngestionTool.java
static Options getOptions() { final Options options = new Options(); final Option helpOption = new Option("h", "help", false, "Prints the tool usage."); options.addOption(helpOption);// ww w .j a v a 2 s .c om final Option sensorOption = new Option("s", "sensor", true, "Defines the sensor to be ingested."); options.addOption(sensorOption); final Option configOption = new Option("c", "config", true, "Defines the configuration directory. Defaults to './config'."); options.addOption(configOption); final Option startOption = new Option("start", "start-time", true, "Define the starting time of products to inject."); startOption.setArgName("Date"); options.addOption(startOption); final Option endOption = new Option("end", "end-time", true, "Define the ending time of products to inject."); endOption.setArgName("Date"); options.addOption(endOption); final Option versionOption = new Option("v", "version", true, "Define the sensor version."); options.addOption(versionOption); return options; }
From source file:com.linkedin.helix.mock.storage.MockHealthReportParticipant.java
@SuppressWarnings("static-access") synchronized private static Options constructCommandLineOptions() { Option helpOption = OptionBuilder.withLongOpt(help).withDescription("Prints command-line options info") .create();/*from w w w . ja v a 2 s .c o m*/ Option clusterOption = OptionBuilder.withLongOpt(cluster).withDescription("Provide cluster name").create(); clusterOption.setArgs(1); clusterOption.setRequired(true); clusterOption.setArgName("Cluster name (Required)"); Option hostOption = OptionBuilder.withLongOpt(host).withDescription("Provide host name").create(); hostOption.setArgs(1); hostOption.setRequired(true); hostOption.setArgName("Host name (Required)"); Option portOption = OptionBuilder.withLongOpt(port).withDescription("Provide host port").create(); portOption.setArgs(1); portOption.setRequired(true); portOption.setArgName("Host port (Required)"); Option zkServerOption = OptionBuilder.withLongOpt(zkServer).withDescription("Provide zookeeper address") .create(); zkServerOption.setArgs(1); zkServerOption.setRequired(true); zkServerOption.setArgName("Zookeeper server address(Required)"); Options options = new Options(); options.addOption(helpOption); options.addOption(clusterOption); options.addOption(hostOption); options.addOption(portOption); options.addOption(zkServerOption); return options; }