Example usage for org.apache.commons.cli OptionBuilder withDescription

List of usage examples for org.apache.commons.cli OptionBuilder withDescription

Introduction

In this page you can find the example usage for org.apache.commons.cli OptionBuilder withDescription.

Prototype

public static OptionBuilder withDescription(String newDescription) 

Source Link

Document

The next Option created will have the specified description

Usage

From source file:com.controlj.experiment.bulktrend.trendclient.Main.java

private static Options setupCLOptions() {
    Options options = new Options();

    options.addOption(OptionBuilder.withArgName("directory").hasArg()
            .withDescription("Directory for trendclient.properties and trendclient.sources").create(PARAM_DIR));

    options.addOption(OptionBuilder.withArgName("startDate").hasArg()
            .withDescription("Starting date to retrieve trends (mm/dd/yyyy). " + "Defaults to yesterday.")
            .create(PARAM_START));//ww w  .j  a  v a  2 s .  c  om

    options.addOption(OptionBuilder.withArgName("endDate").hasArg()
            .withDescription("Ending date to retrieve trends (mm/dd/yyyy). " + "Defaults to yesterday.")
            .create(PARAM_END));

    options.addOption(OptionBuilder.create("help"));

    options.addOption(OptionBuilder.withDescription("Disable zip compression").create(PARAM_NOZIP));

    options.addOption(OptionBuilder.withArgName("file").hasOptionalArg()
            .withDescription("Read data from file instead of over HTTP").create(PARAM_TESTFILE));

    return options;
}

From source file:com.github.errantlinguist.latticevisualiser.ArgParser.java

/**
 * Creates and adds a vertical size option to a given {@link Options}
 * object./*from w  w w.  java 2 s  .c  o m*/
 * 
 * @param options
 *            The <code>Options</code> object to add to.
 */
private static void addYSizeOption(final Options options) {
    OptionBuilder.withLongOpt(HEIGHT_KEY_LONG);
    OptionBuilder.withDescription(HEIGHT_DESCR);
    OptionBuilder.hasArg();
    OptionBuilder.withArgName(SIZE_ARG_NAME);
    OptionBuilder.withType(int.class);

    final Option height = OptionBuilder.create(HEIGHT_KEY);
    options.addOption(height);
}

From source file:edu.usc.scrc.PriorityPruner.CommandLineOptions.java

/**
 * Creates an Option-object with both a full and a shorthand version of its
 * name.//from w  w w  .  j a v  a2  s .co  m
 * 
 * @param numArgs
 *            number of arguments required for every argument entry
 * @param typeOfArg
 *            type of argument expected
 * @param longOpt
 *            full name of this option
 * @param desc
 *            description of this option
 * @param isReq
 *            specifies if this option is required or not
 * @param shortOpt
 *            shorthand name for this option
 * @return a static Option-object
 */
private static Option createOptionTwoNames(int numArgs, String typeOfArg, String longOpt, String desc,
        boolean isReq, String shortOpt) {

    OptionBuilder.hasArgs(numArgs);
    OptionBuilder.withArgName(typeOfArg);
    OptionBuilder.withLongOpt(longOpt);
    OptionBuilder.withDescription(desc);
    OptionBuilder.isRequired(isReq);
    return OptionBuilder.create(shortOpt);
}

From source file:acromusashi.stream.tools.TopologyExecutionWaitTool.java

/**
 * Generate command line analyze option object.
 * //from w  ww.ja v a2s  .co m
 * @return command line analyze option object
 */
public static Options createOptions() {
    Options cliOptions = new Options();

    // Config path option
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("Storm config path");
    OptionBuilder.withDescription("Storm config path");
    OptionBuilder.isRequired(false);
    Option configOption = OptionBuilder.create("c");

    // Check interval option
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("Check interval(Sec)");
    OptionBuilder.withDescription("Check interval(Sec)");
    OptionBuilder.isRequired(false);
    Option intervalOption = OptionBuilder.create("i");

    // Check target topology name
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("Check target topology name");
    OptionBuilder.withDescription("Check target topology name");
    OptionBuilder.isRequired(true);
    Option targetOption = OptionBuilder.create("t");

    // Wait timeout option
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("Wait timeout(Sec)");
    OptionBuilder.withDescription("Wait timeout(Sec)");
    OptionBuilder.isRequired(false);
    Option waitOption = OptionBuilder.create("w");

    // Help option
    OptionBuilder.withDescription("show help");
    Option helpOption = OptionBuilder.create("sh");

    cliOptions.addOption(configOption);
    cliOptions.addOption(intervalOption);
    cliOptions.addOption(targetOption);
    cliOptions.addOption(waitOption);
    cliOptions.addOption(helpOption);
    return cliOptions;
}

From source file:com.linkedin.databus2.core.schema.tools.AvroConvertMain.java

@SuppressWarnings("static-access")
public AvroConvertCli() {

    Option helpOption = OptionBuilder.withLongOpt(HELP_OPT_NAME).withDescription("this help screen")
            .create(HELP_OPT_CHAR);/*www  . j  ava 2  s  .com*/
    Option inpFormatOption = OptionBuilder.withLongOpt(INPUT_FORMAT_OPT_NAME)
            .withDescription("Input format: JSON, JSON_LINES, BINARY").hasArg().withArgName("format")
            .create(INPUT_FORMAT_OPT_CHAR);
    Option outFormatOption = OptionBuilder.withLongOpt(OUTPUT_FORMAT_OPT_NAME)
            .withDescription("Output format: JSON, JSON_LINES, BINARY").hasArg().withArgName("format")
            .create(OUTPUT_FORMAT_OPT_CHAR);
    Option inpSchemaOption = OptionBuilder.withLongOpt(INPUT_SCHEMA_OPT_NAME)
            .withDescription("Input schema file").hasArg().withArgName("file").create(INPUT_SCHEMA_OPT_CHAR);
    Option outSchemaOption = OptionBuilder.withLongOpt(OUTPUT_SCHEMA_OPT_NAME)
            .withDescription("Output schema file").hasArg().withArgName("file").create(OUTPUT_SCHEMA_OPT_CHAR);
    Option inpFileOption = OptionBuilder.withLongOpt(INPUT_FILE_OPT_NAME)
            .withDescription("input file name or - for STDIN").hasArg().withArgName("file | - ")
            .create(INPUT_FILE_OPT_CHAR);
    Option outFileOption = OptionBuilder.withLongOpt(OUTPUT_FILE_OPT_NAME)
            .withDescription("output file name or - for STDOUT").hasArg().withArgName("file | - ")
            .create(OUTPUT_FILE_OPT_CHAR);
    Option verboseOption = OptionBuilder.withDescription("verbose; more occurrences increase verbosity")
            .create(VERBOSE_OPT_CHAR);

    _options.addOption(helpOption);
    _options.addOption(inpFormatOption);
    _options.addOption(outFormatOption);
    _options.addOption(inpSchemaOption);
    _options.addOption(outSchemaOption);
    _options.addOption(inpFileOption);
    _options.addOption(outFileOption);
    _options.addOption(verboseOption);
}

From source file:com.hdfs.concat.crush.Crush.java

@SuppressWarnings("static-access")
Options buildOptions() {//from w ww  . j av  a2s.co  m
    Options options = new Options();
    Option option;

    option = OptionBuilder.withDescription("Print this help message").withLongOpt("help").create("?");

    options.addOption(option);

    option = OptionBuilder.hasArg().withArgName("directory regex").withDescription(
            "Regular expression that matches a directory name. Used to match a directory with a correponding replacement string")
            .withLongOpt("regex").create();

    options.addOption(option);

    option = OptionBuilder.hasArg().withArgName("ignore file regex").withDescription(
            "Regular expression to apply for filtering out crush candidate files.  Any files in the input crush directory matching this will be ignored")
            .withLongOpt("ignore-regex").create();

    options.addOption(option);

    option = OptionBuilder.hasArg().withArgName("replacement string").withDescription(
            "Replacement string used with the corresponding regex to calculate the name of a directory's crush output file")
            .withLongOpt("replacement").create();

    options.addOption(option);

    option = OptionBuilder.hasArg().withArgName("FQN input format")
            .withDescription(
                    "Input format used to open the files of directories matching the corresponding regex")
            .withLongOpt("input-format").create();

    options.addOption(option);

    option = OptionBuilder.hasArg().withArgName("FQN output format")
            .withDescription(
                    "Output format used to open the files of directories matching the corresponding regex")
            .withLongOpt("output-format").create();

    options.addOption(option);

    option = OptionBuilder.hasArg().withArgName("threshold").withDescription(
            "Threshold relative to the dfs block size over which a file becomes eligible for crushing. Must be in the range (0 and 1]. Default 0.75")
            .withLongOpt("threshold").create();

    options.addOption(option);

    option = OptionBuilder.hasArg().withArgName("max-file-blocks").withDescription(
            "The maximum number of dfs blocks per output file. Input files are grouped into output files under the assumption that the input and output compression codecs have comparable efficiency. Default is 8.")
            .withLongOpt("max-file-blocks").create();

    options.addOption(option);

    option = OptionBuilder.withDescription("Do not skip directories containing single files.")
            .withLongOpt("include-single-file-dirs").create();

    options.addOption(option);

    option = OptionBuilder.hasArg().withArgName("compression codec")
            .withDescription("FQN of the compression codec to use or \"none\". Defaults to DefaultCodec.")
            .withLongOpt("compress").create();

    options.addOption(option);

    option = OptionBuilder.withDescription("Operate in clone mode.").withLongOpt("clone").create();

    options.addOption(option);

    option = OptionBuilder.withDescription("Info logging to console.").withLongOpt("info").create();

    options.addOption(option);

    option = OptionBuilder.withDescription("Verbose logging to console.").withLongOpt("verbose").create();

    options.addOption(option);

    return options;
}

From source file:de.clusteval.data.dataset.generator.DataSetGenerator.java

/**
 * Adds the default options of dataset generators to the given Options
 * attribute//ww  w. ja v a 2 s  . c o  m
 * 
 * @param options
 *            The existing Options attribute, holding already the options of
 *            the actual generator implementation.
 */
private void addDefaultOptions(final Options options) {
    OptionBuilder.withArgName("folderName");
    OptionBuilder.isRequired();
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("The name of the folder to store this dataset in.");
    Option option = OptionBuilder.create("folderName");
    options.addOption(option);

    OptionBuilder.withArgName("fileName");
    OptionBuilder.isRequired();
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("The name of the dataset file to generate.");
    option = OptionBuilder.create("fileName");
    options.addOption(option);

    OptionBuilder.withArgName("alias");
    OptionBuilder.isRequired();
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("The alias of the data set.");
    option = OptionBuilder.create("alias");
    options.addOption(option);
}

From source file:ca.appbox.monitoring.jmx.jmxbox.commons.context.parser.JmxContextParserImpl.java

@SuppressWarnings("static-access")
private Options buildOptions() {

    Options options = new Options();

    Option help = OptionBuilder.withDescription("prints this message").create(CommandLineOptions.HELP);

    Option host = OptionBuilder.withDescription("jmx host").withArgName("host").hasArg(true)
            .create(CommandLineOptions.HOST);

    Option port = OptionBuilder.withDescription("jmx port").withArgName("port").hasArg(true)
            .create(CommandLineOptions.PORT);

    Option user = OptionBuilder.withDescription("user").withArgName("user").hasArg(true)
            .create(CommandLineOptions.USER);

    Option password = OptionBuilder.withDescription("password").withArgName("password").hasArg(true)
            .create(CommandLineOptions.PASSWORD);

    Option interval = OptionBuilder.withDescription("interval  (in miliseconds, default : 1000)")
            .withArgName("interval").hasArg(true).create(CommandLineOptions.INTERVAL_IN_SECONDS);

    Option outputFile = OptionBuilder.withDescription("csv file for output").withArgName("output file")
            .hasArg(true).create(CommandLineOptions.OUTPUT_FILE);

    Option recordDelimiter = OptionBuilder.withDescription("record delimiter (default : \";\")")
            .withArgName("record deliniter").hasArg(true).create(CommandLineOptions.RECORD_DELIMITER);

    Option repetitions = OptionBuilder.withDescription("number of repetitions (default : 1, 0 : loop for ever)")
            .withArgName("repetitions").hasArg(true).create(CommandLineOptions.REPETITIONS);

    Option readAttribute = OptionBuilder.withDescription("attribute(s) to read (mBeanName;attr1;attr2;attrN)")
            .withArgName("mBean attribute(s)").hasArg(true).create(CommandLineOptions.READ_ATTRIBUTE);

    Option operation = OptionBuilder
            .withDescription("operation to invoke (mBeanName;operationName;param1;param2;paramN)")
            .withArgName("mBean operation").hasArg(true).create(CommandLineOptions.INVOKE);

    Option utcTimestamps = OptionBuilder.withDescription("use UTC timestamps")
            .create(CommandLineOptions.UTC_TIMESTAMPS);

    options.addOption(help);//from  w w  w .  j a  v  a2 s  . c  o m
    options.addOption(host);
    options.addOption(port);
    options.addOption(repetitions);
    options.addOption(readAttribute);
    options.addOption(operation);
    options.addOption(user);
    options.addOption(password);
    options.addOption(interval);
    options.addOption(outputFile);
    options.addOption(recordDelimiter);
    options.addOption(utcTimestamps);

    return options;
}

From source file:languageTools.Analyzer.java

/**
 * Creates the command line options.//from w  w w  .j  a  v a 2  s .  c  om
 *
 * @return The command line options.
 */
private static Options createOptions() {
    Options options = new Options();

    OptionBuilder.withDescription("Output tokens generated by lexer");
    options.addOption(OptionBuilder.create(OPTION_LEXER));

    OptionBuilder.withDescription("Program generated by parser");
    options.addOption(OptionBuilder.create(OPTION_PROGRAM));

    OptionBuilder.withDescription("Analyze MAS files");
    options.addOption(OptionBuilder.create(OPTION_MAS));

    OptionBuilder.withDescription("Analyze GOAL agent files");
    options.addOption(OptionBuilder.create(OPTION_GOAL));

    OptionBuilder.withDescription("Analyze module files");
    options.addOption(OptionBuilder.create(OPTION_MOD2G));

    OptionBuilder.withDescription("Recursively search directories for files");
    OptionBuilder.withLongOpt(OPTION_RECURSIVE);
    options.addOption(OptionBuilder.create(OPTION_RECURSIVE_SHORT));

    options.addOption(new Option(OPTION_HELP_SHORT, OPTION_HELP, false, "Displays this help"));

    OptionBuilder.withDescription("Shows the license");
    OptionBuilder.withLongOpt(OPTION_LICENSE);
    options.addOption(OptionBuilder.create());

    return options;
}

From source file:edu.usc.scrc.PriorityPruner.CommandLineOptions.java

/**
 * Creates an Option-object with specified parameters, without a shorthand
 * version of its name./*from   w w w  .j  av  a 2s.com*/
 * 
 * @param numArgs
 *            number of arguments required for an argument entry
 * @param typeOfArg
 *            type of argument expected
 * @param desc
 *            description of this option
 * @param isReq
 *            specifies if this option is required or not
 * @param shortOpt
 *            short name for this option
 * @return a static Option-object
 */
private static Option createOptionOneName(int numArgs, String typeOfArg, String desc, boolean isReq,
        String longOpt) {

    OptionBuilder.hasArgs(numArgs);
    OptionBuilder.withArgName(typeOfArg);
    OptionBuilder.withDescription(desc);
    OptionBuilder.isRequired(isReq);
    return OptionBuilder.create(longOpt);
}