List of usage examples for org.apache.commons.cli OptionBuilder withDescription
public static OptionBuilder withDescription(String newDescription)
From source file:fr.iphc.grid.jobmonitor.JobList.java
protected Options createOptions() { Options opt = new Options(); // command/*from w w w . ja v a2 s .c om*/ opt.addOption(OptionBuilder.withDescription("Display this help and exit").withLongOpt(LONGOPT_HELP) .create(OPT_HELP)); // returns return opt; }
From source file:com.google.code.linkedinapi.client.examples.PostCommentExample.java
/** * Build command line options object./*from w w w .ja v a 2 s . co m*/ */ private static Options buildOptions() { Options opts = new Options(); String helpMsg = "Print this message."; Option help = new Option(HELP_OPTION, helpMsg); opts.addOption(help); String consumerKeyMsg = "You API Consumer Key."; OptionBuilder.withArgName("consumerKey"); OptionBuilder.hasArg(); OptionBuilder.withDescription(consumerKeyMsg); Option consumerKey = OptionBuilder.create(CONSUMER_KEY_OPTION); opts.addOption(consumerKey); String consumerSecretMsg = "You API Consumer Secret."; OptionBuilder.withArgName("consumerSecret"); OptionBuilder.hasArg(); OptionBuilder.withDescription(consumerSecretMsg); Option consumerSecret = OptionBuilder.create(CONSUMER_SECRET_OPTION); opts.addOption(consumerSecret); String accessTokenMsg = "You OAuth Access Token."; OptionBuilder.withArgName("accessToken"); OptionBuilder.hasArg(); OptionBuilder.withDescription(accessTokenMsg); Option accessToken = OptionBuilder.create(ACCESS_TOKEN_OPTION); opts.addOption(accessToken); String tokenSecretMsg = "You OAuth Access Token Secret."; OptionBuilder.withArgName("accessTokenSecret"); OptionBuilder.hasArg(); OptionBuilder.withDescription(tokenSecretMsg); Option accessTokenSecret = OptionBuilder.create(ACCESS_TOKEN_SECRET_OPTION); opts.addOption(accessTokenSecret); String idMsg = "ID of the post on which to comment."; OptionBuilder.withArgName("postId"); OptionBuilder.hasArg(); OptionBuilder.withDescription(idMsg); Option id = OptionBuilder.create(POST_ID_OPTION); opts.addOption(id); String commentMsg = "Text of the comment."; OptionBuilder.withArgName("comment"); OptionBuilder.hasArg(); OptionBuilder.withDescription(commentMsg); Option comment = OptionBuilder.create(COMMENT_TEXT_OPTION); opts.addOption(comment); return opts; }
From source file:com.flaptor.indextank.storage.IndexesLogServer.java
@SuppressWarnings("static-access") private static Options getOptions() { Option rport = OptionBuilder.withArgName("reader_port").hasArg().withDescription("Server Port") .withLongOpt("reader_port").create("rp"); Option mport = OptionBuilder.withArgName("reader_port").hasArg().withDescription("Server Port") .withLongOpt("manager_port").create("mp"); Option help = OptionBuilder.withDescription("Displays this help").withLongOpt("help").create("h"); Options options = new Options(); options.addOption(rport);/*from w w w. j a v a 2 s .c om*/ options.addOption(mport); options.addOption(help); return options; }
From source file:com.google.code.linkedinapi.client.examples.PostShareExample.java
/** * Build command line options object./* w w w .j ava2 s .co m*/ */ private static Options buildOptions() { Options opts = new Options(); String helpMsg = "Print this message."; Option help = new Option(HELP_OPTION, helpMsg); opts.addOption(help); String consumerKeyMsg = "You API Consumer Key."; OptionBuilder.withArgName("consumerKey"); OptionBuilder.hasArg(); OptionBuilder.withDescription(consumerKeyMsg); Option consumerKey = OptionBuilder.create(CONSUMER_KEY_OPTION); opts.addOption(consumerKey); String consumerSecretMsg = "You API Consumer Secret."; OptionBuilder.withArgName("consumerSecret"); OptionBuilder.hasArg(); OptionBuilder.withDescription(consumerSecretMsg); Option consumerSecret = OptionBuilder.create(CONSUMER_SECRET_OPTION); opts.addOption(consumerSecret); String accessTokenMsg = "You OAuth Access Token."; OptionBuilder.withArgName("accessToken"); OptionBuilder.hasArg(); OptionBuilder.withDescription(accessTokenMsg); Option accessToken = OptionBuilder.create(ACCESS_TOKEN_OPTION); opts.addOption(accessToken); String tokenSecretMsg = "You OAuth Access Token Secret."; OptionBuilder.withArgName("accessTokenSecret"); OptionBuilder.hasArg(); OptionBuilder.withDescription(tokenSecretMsg); Option accessTokenSecret = OptionBuilder.create(ACCESS_TOKEN_SECRET_OPTION); opts.addOption(accessTokenSecret); String statusMsg = "Text of the share."; OptionBuilder.withArgName("share"); OptionBuilder.hasArg(); OptionBuilder.withDescription(statusMsg); Option status = OptionBuilder.create(SHARE_TEXT_OPTION); opts.addOption(status); String urlMsg = "URL to be shared."; OptionBuilder.withArgName("url"); OptionBuilder.hasArg(); OptionBuilder.withDescription(urlMsg); Option url = OptionBuilder.create(URL_OPTION); opts.addOption(url); return opts; }
From source file:com.google.code.stackexchange.client.examples.AsyncApiExample.java
/** * Builds the options./*from w w w .j a v a 2 s. c om*/ * * @return the options */ private static Options buildOptions() { Options opts = new Options(); String helpMsg = "Print this message."; Option help = new Option(HELP_OPTION, helpMsg); opts.addOption(help); String consumerKeyMsg = "You API Key."; OptionBuilder.withArgName("key"); OptionBuilder.hasArg(); OptionBuilder.withDescription(consumerKeyMsg); Option consumerKey = OptionBuilder.create(APPLICATION_KEY_OPTION); opts.addOption(consumerKey); return opts; }
From source file:com.google.code.linkedinapi.client.examples.PostStatusExample.java
/** * Build command line options object./*from www. j av a2 s . c o m*/ */ private static Options buildOptions() { Options opts = new Options(); String helpMsg = "Print this message."; Option help = new Option(HELP_OPTION, helpMsg); opts.addOption(help); String consumerKeyMsg = "You API Consumer Key."; OptionBuilder.withArgName("consumerKey"); OptionBuilder.hasArg(); OptionBuilder.withDescription(consumerKeyMsg); Option consumerKey = OptionBuilder.create(CONSUMER_KEY_OPTION); opts.addOption(consumerKey); String consumerSecretMsg = "You API Consumer Secret."; OptionBuilder.withArgName("consumerSecret"); OptionBuilder.hasArg(); OptionBuilder.withDescription(consumerSecretMsg); Option consumerSecret = OptionBuilder.create(CONSUMER_SECRET_OPTION); opts.addOption(consumerSecret); String accessTokenMsg = "You OAuth Access Token."; OptionBuilder.withArgName("accessToken"); OptionBuilder.hasArg(); OptionBuilder.withDescription(accessTokenMsg); Option accessToken = OptionBuilder.create(ACCESS_TOKEN_OPTION); opts.addOption(accessToken); String tokenSecretMsg = "You OAuth Access Token Secret."; OptionBuilder.withArgName("accessTokenSecret"); OptionBuilder.hasArg(); OptionBuilder.withDescription(tokenSecretMsg); Option accessTokenSecret = OptionBuilder.create(ACCESS_TOKEN_SECRET_OPTION); opts.addOption(accessTokenSecret); String statusMsg = "Text of the status."; OptionBuilder.withArgName("status"); OptionBuilder.hasArg(); OptionBuilder.withDescription(statusMsg); Option status = OptionBuilder.create(STATUS_TEXT_OPTION); opts.addOption(status); String deleteMsg = "Delete current status."; Option delete = new Option(DELETE_OPTION, deleteMsg); opts.addOption(delete); return opts; }
From source file:be.svlandeg.diffany.console.DiffanyOptions.java
/** * Define the options specifying necessary arguments for the Diffany algorithms */// ww w . j a v a 2 s. c om private Set<Option> getAllParameters() { Set<Option> allParameters = new HashSet<Option>(); OptionBuilder.withArgName("dir"); OptionBuilder.withLongOpt("inputDir"); OptionBuilder.hasArgs(1); OptionBuilder.isRequired(); OptionBuilder .withDescription("the input directory containing the reference and condition-specific networks"); allParameters.add(OptionBuilder.create(inputShort)); OptionBuilder.withArgName("dir"); OptionBuilder.withLongOpt("outputDir"); OptionBuilder.hasArgs(1); OptionBuilder.isRequired(); OptionBuilder.withDescription( "the output directory which will contain the generated differential/consensus networks"); allParameters.add(OptionBuilder.create(outputShort)); String defaultRunDiffString = defaultRunDiff ? "yes" : "no"; OptionBuilder.withLongOpt("differential"); OptionBuilder.hasArgs(1); OptionBuilder.withDescription("whether or not to calculate differential networks: yes or no (default=" + defaultRunDiffString + ")"); allParameters.add(OptionBuilder.create(runDiff)); String defaultRunConsString = defaultRunCons ? "yes" : "no"; ; OptionBuilder.withLongOpt("consensus"); OptionBuilder.hasArgs(1); OptionBuilder.withDescription( "whether or not to calculate consensus networks: yes or no (default=" + defaultRunConsString + ")"); allParameters.add(OptionBuilder.create(runCons)); OptionBuilder.withLongOpt("outputID"); OptionBuilder.hasArgs(1); OptionBuilder.withDescription("the first ID that will be used for the generated networks"); allParameters.add(OptionBuilder.create(nextID)); OptionBuilder.withLongOpt("confidence"); OptionBuilder.hasArgs(1); OptionBuilder.withDescription( "the minimum confidence threshold for output edges, as an integer or double (default=0.0)"); allParameters.add(OptionBuilder.create(cutoffShort)); String defaultMinOperatorString = defaultMinOperator ? "min" : "max"; OptionBuilder.withLongOpt("operator"); OptionBuilder.hasArgs(1); OptionBuilder.withDescription("the operator used to create consensus edges: min or max (default=" + defaultMinOperatorString + ")"); allParameters.add(OptionBuilder.create(operatorShort)); String defaultModeString = defaultModePairwise ? "pairwise" : "all"; OptionBuilder.withLongOpt("mode"); OptionBuilder.hasArgs(1); OptionBuilder .withDescription("the mode of comparison: pairwise or all (default=" + defaultModeString + ")"); allParameters.add(OptionBuilder.create(modeShort)); String defaultHeaderString = defaultReadHeader ? "yes" : "no"; OptionBuilder.withLongOpt("skipHeader"); OptionBuilder.hasArgs(1); OptionBuilder.withDescription( "whether or not to skip the first line (header) in the network .txt files (default=" + defaultHeaderString + ")"); allParameters.add(OptionBuilder.create(headerShort)); return allParameters; }
From source file:ch.qos.logback.decoder.cli.MainArgs.java
/** * Creates the options for the command-line arguments * * @return the newly created options//from w w w.j a v a 2 s . c om */ @SuppressWarnings("static-access") private final Options createOptions() { Options opts = new Options(); Option help = OptionBuilder.withDescription("Print this help message and exit").withLongOpt("help") .create("h"); opts.addOption(help); Option version = OptionBuilder.withDescription("Print version information and exit").withLongOpt("version") .create("v"); opts.addOption(version); Option layoutPattern = OptionBuilder.withArgName("pattern").hasArg() .withDescription("Layout pattern to use (overrides file's pattern)").withLongOpt("layout") .create("p"); opts.addOption(layoutPattern); Option infile = OptionBuilder.withArgName("path").hasArg() .withDescription("Log file to parse (default: stdin)").withLongOpt("input-file").create("f"); opts.addOption(infile); Option debug = OptionBuilder.withDescription("Enable debug mode").withLongOpt("debug").create("d"); opts.addOption(debug); Option verbose = OptionBuilder.withDescription("Be verbose when printing information") .withLongOpt("verbose").create(); opts.addOption(verbose); Option property = OptionBuilder.withArgName("property=value").hasArgs(2).withValueSeparator() .withDescription("use value for given property").create("D"); opts.addOption(property); return opts; }
From source file:com.github.errantlinguist.latticevisualiser.ArgParser.java
/** * Creates and adds a lattice infile option to a given {@link Options} * object.// ww w . j a v a2 s. c o m * * @param options * The <code>Options</code> object to add to. */ private static void addLatticeInfileOption(final Options options) { OptionBuilder.isRequired(true); OptionBuilder.withLongOpt(LATTICE_INFILE_KEY_LONG); OptionBuilder.withDescription(LATTICE_INFILE_DESCR); OptionBuilder.hasArg(); OptionBuilder.withArgName(INFILE_ARG_NAME); OptionBuilder.withType(File.class); final Option latticeInfile = OptionBuilder.create(LATTICE_INFILE_KEY); options.addOption(latticeInfile); }
From source file:com.flaptor.indextank.storage.LogWriterServer.java
@SuppressWarnings("static-access") private static Options getOptions() { Option port = OptionBuilder.withArgName("port").hasArg().withDescription("Server Port").withLongOpt("port") .create("p"); Option path = OptionBuilder.withArgName("path").hasArg().withDescription("Logs Path").withLongOpt("path") .isRequired(false).create("f"); Option help = OptionBuilder.withDescription("Displays this help").withLongOpt("help").create("h"); Options options = new Options(); options.addOption(port);/*from w w w . ja v a 2 s . c o m*/ options.addOption(path); options.addOption(help); return options; }