Example usage for org.apache.commons.cli Option UNLIMITED_VALUES

List of usage examples for org.apache.commons.cli Option UNLIMITED_VALUES

Introduction

In this page you can find the example usage for org.apache.commons.cli Option UNLIMITED_VALUES.

Prototype

int UNLIMITED_VALUES

To view the source code for org.apache.commons.cli Option UNLIMITED_VALUES.

Click Source Link

Document

constant that specifies the number of argument values is infinite

Usage

From source file:de.uni_koblenz.jgralab.utilities.csv2tg.Csv2Tg.java

final protected OptionHandler createOptionHandler() {
    String toolString = "java " + this.getClass().getName();
    String versionString = JGraLab.getInfo(false);
    OptionHandler oh = new OptionHandler(toolString, versionString);

    Option schema = new Option("s", CLI_OPTION_SCHEMA, true,
            "(required): the schema according to which the graph should be constructed.");
    schema.setRequired(true);/*from  w  w w .  java  2 s. c  o  m*/
    schema.setArgName("file");
    oh.addOption(schema);

    Option csvFiles = new Option("i", CLI_OPTION_CSV_FILES, true,
            "(required): set of csv-file containing vertex / edge instance informations.");
    csvFiles.setRequired(true);
    csvFiles.setArgs(Option.UNLIMITED_VALUES);
    csvFiles.setArgName("files_or_folder");
    csvFiles.setValueSeparator(' ');
    oh.addOption(csvFiles);

    Option output = new Option("o", CLI_OPTION_OUTPUT_FILE, true,
            "(required): the output file name, or empty for stdout");
    output.setRequired(true);
    output.setArgName("file");
    oh.addOption(output);

    return oh;
}

From source file:eu.stratosphere.pact.client.CliFrontend.java

/**
 * Builds command line options for the run action.
 * /*from   w ww .java2s .co  m*/
 * @return Command line options for the run action.
 */
private Options getRunOptions() {

    Options options = new Options();

    // run options
    JAR_OPTION.setRequired(false);
    JAR_OPTION.setArgName("jarfile");
    options.addOption(JAR_OPTION);
    CLASS_OPTION.setRequired(false);
    CLASS_OPTION.setArgName("classname");
    options.addOption(CLASS_OPTION);
    ARGS_OPTION.setRequired(false);
    ARGS_OPTION.setArgName("programArgs");
    ARGS_OPTION.setArgs(Option.UNLIMITED_VALUES);
    options.addOption(ARGS_OPTION);
    WAIT_OPTION.setRequired(false);
    options.addOption(WAIT_OPTION);

    return options;
}

From source file:com.rabbitmq.examples.PerfTest.java

private static Options getOptions() {
    Options options = new Options();
    options.addOption(new Option("?", "help", false, "show usage"));
    options.addOption(new Option("h", "uri", true, "connection URI"));
    options.addOption(new Option("t", "type", true, "exchange type"));
    options.addOption(new Option("e", "exchange", true, "exchange name"));
    options.addOption(new Option("u", "queue", true, "queue name"));
    options.addOption(new Option("k", "routingKey", true, "routing key"));
    options.addOption(new Option("K", "randomRoutingKey", false, "use random routing key per message"));
    options.addOption(new Option("i", "interval", true, "sampling interval in seconds"));
    options.addOption(new Option("r", "rate", true, "producer rate limit"));
    options.addOption(new Option("R", "consumerRate", true, "consumer rate limit"));
    options.addOption(new Option("x", "producers", true, "producer count"));
    options.addOption(new Option("y", "consumers", true, "consumer count"));
    options.addOption(new Option("m", "ptxsize", true, "producer tx size"));
    options.addOption(new Option("n", "ctxsize", true, "consumer tx size"));
    options.addOption(new Option("c", "confirm", true, "max unconfirmed publishes"));
    options.addOption(new Option("a", "autoack", false, "auto ack"));
    options.addOption(new Option("A", "multiAckEvery", true, "multi ack every"));
    options.addOption(new Option("q", "qos", true, "consumer prefetch count"));
    options.addOption(new Option("Q", "globalQos", true, "channel prefetch count"));
    options.addOption(new Option("s", "size", true, "message size in bytes"));
    options.addOption(new Option("z", "time", true, "run duration in seconds (unlimited by default)"));
    options.addOption(new Option("C", "pmessages", true, "producer message count"));
    options.addOption(new Option("D", "cmessages", true, "consumer message count"));
    Option flag = new Option("f", "flag", true, "message flag");
    flag.setArgs(Option.UNLIMITED_VALUES);
    options.addOption(flag);/*from   w  w w.  j av  a  2s.c  o m*/
    options.addOption(new Option("M", "framemax", true, "frame max"));
    options.addOption(new Option("b", "heartbeat", true, "heartbeat interval"));
    options.addOption(new Option("p", "predeclared", false, "allow use of predeclared objects"));
    return options;
}

From source file:com.zaradai.kunzite.trader.tools.EodConverterOptionsParser.java

@Override
protected void addOptions(Options options) {
    Option property = OptionBuilder.withLongOpt(PROPERTY_OPTION).withArgName("key=value").hasArgs(2)
            .withValueSeparator().withDescription("Generic key value pair properties").create('p');
    options.addOption(property);// w w  w  . ja  v a  2s.c o  m
    options.addOption("s", SOURCE_OPTION, true, "Source folder containing encoded files for input types that "
            + "store their data in folders such as CSV.  If specified the folder must exist");
    Option sourceType = new Option("i", SOURCE_TYPE_OPTION, true,
            "Source input type, e.g. CSV, COMPACT, MONGO");
    sourceType.setRequired(true);
    options.addOption(sourceType);
    options.addOption("t", TARGET_OPTION, true, "Target folder containing encoded files for output types that "
            + "store their data in folders such as CSV.  If specified the folder must exist");
    Option targetType = new Option("o", TARGET_TYPE_OPTION, true,
            "Target output type, e.g. CSV, COMPACT, MONGO");
    targetType.setRequired(true);
    options.addOption(targetType);
    Option symbolsOption = OptionBuilder.withLongOpt(SYMBOLS_OPTION).isRequired().withArgName("values")
            .withValueSeparator(' ').hasArgs(Option.UNLIMITED_VALUES)
            .withDescription("A list of space separated symbols to download data for, e.g. INTC AAPL F AMAT")
            .create("sm");
    options.addOption(symbolsOption);
    options.addOption("th", THREADS_OPTION, true, "Specify number of conversion threads, default is 1");
}

From source file:com.zaradai.kunzite.trader.tools.EodDownloadOptionsParser.java

@Override
protected void addOptions(Options options) {
    options.addOption(OptionBuilder.withLongOpt(PROPERTY_OPTION).withArgName("key=value").hasArgs(2)
            .withValueSeparator().withDescription("Generic key value pair properties").create('p'));
    options.addOption(OptionBuilder.withLongOpt(TARGET_OPTION).withArgName("target folder").hasArgs(1)
            .withDescription("Target folder to contain encoded files for output types that "
                    + "store their data in folders such as CSV.  If specified the folder must exist")
            .create("t"));
    options.addOption(OptionBuilder.withLongOpt(TARGET_TYPE_OPTION).withArgName("type").hasArgs(1)
            .withDescription("Target output type, e.g. CSV, COMPACT, MONGO").create("o"));
    options.addOption(OptionBuilder.withLongOpt(SYMBOLS_OPTION).isRequired().withArgName("values")
            .withValueSeparator(' ').hasArgs(Option.UNLIMITED_VALUES)
            .withDescription("A list of space separated symbols to download data for, e.g. INTC AAPL F AMAT")
            .create("sm"));
    options.addOption(OptionBuilder.withLongOpt(THREADS_OPTION).withArgName("num threads").hasArgs(1)
            .withDescription("Specify number of conversion threads, default is 1").create("th"));
    options.addOption(OptionBuilder.withLongOpt(FROM_OPTION).isRequired().hasArgs(1).withArgName("date")
            .withDescription("Date to start the download from, format is YYYY-MM-dd, e.g. 2013-06-14")
            .create("f"));
    options.addOption(OptionBuilder.withLongOpt(UNTIL_OPTION).withArgName("date").hasArgs(1)
            .withDescription(/*from   w ww .  ja v  a 2s. co  m*/
                    "Date to end the download range, format is YYYY-MM-dd, e.g. 2013-06-14.  Default is"
                            + " today if not specified")
            .create("u"));
}

From source file:eu.stratosphere.client.CliFrontend.java

private static void initOptions() {
    HELP_OPTION.setRequired(false);//from w  ww .  j av a  2  s  . co  m
    VERBOSE_OPTION.setRequired(false);

    JAR_OPTION.setRequired(false);
    JAR_OPTION.setArgName("jarfile");

    CLASS_OPTION.setRequired(false);
    CLASS_OPTION.setArgName("classname");

    ADDRESS_OPTION.setRequired(false);
    ADDRESS_OPTION.setArgName("host:port");

    PARALLELISM_OPTION.setRequired(false);
    PARALLELISM_OPTION.setArgName("parallelism");

    ARGS_OPTION.setRequired(false);
    ARGS_OPTION.setArgName("programArgs");
    ARGS_OPTION.setArgs(Option.UNLIMITED_VALUES);

    PLAN_OPTION.setRequired(false);
    DESCR_OPTION.setRequired(false);

    RUNNING_OPTION.setRequired(false);
    SCHEDULED_OPTION.setRequired(false);

    ID_OPTION.setRequired(false);
    ID_OPTION.setArgName("jobID");
}

From source file:fr.inria.atlanmod.instantiator.SpecimenGenerator.java

/**
 * Configures the program options/*from   w  w  w .  ja v a 2s  .  c  o  m*/
 *
 * @param options
 */
private static void configureOptions(Options options) {
    Option metamodelOpt = OptionBuilder.create(METAMODEL);
    metamodelOpt.setLongOpt(METAMODEL_LONG);
    metamodelOpt.setArgName("path_to_metamodel.ecore");
    metamodelOpt.setDescription("Ecore metamodel");
    metamodelOpt.setArgs(1);
    metamodelOpt.setRequired(true);

    Option additionalMetamodelOpt = OptionBuilder.create(ADDITIONAL_METAMODEL);
    additionalMetamodelOpt.setLongOpt(ADDITIONAL_METAMODEL_LONG);
    additionalMetamodelOpt.setArgName("path_to_metamodel.ecore");
    additionalMetamodelOpt.setDescription("Additional ecore metamodel(s) that need to be registered");
    additionalMetamodelOpt.setArgs(Option.UNLIMITED_VALUES);

    Option outDirOpt = OptionBuilder.create(OUTPUT_DIR);
    outDirOpt.setLongOpt(OUTPUT_DIR_LONG);
    outDirOpt.setArgName("path_to_output.dir");
    outDirOpt.setDescription("Output directory (defaults to working dir)");
    outDirOpt.setArgs(1);

    Option nModelsOpt = OptionBuilder.create(N_MODELS);
    nModelsOpt.setLongOpt(N_MODELS_LONG);
    nModelsOpt.setArgName("models");
    nModelsOpt.setDescription("Number of generated models (defaults to 1)");
    nModelsOpt.setType(Number.class);
    nModelsOpt.setArgs(1);

    Option sizeOption = OptionBuilder.create(SIZE);
    sizeOption.setLongOpt(SIZE_LONG);
    sizeOption.setArgName("size");
    sizeOption.setDescription("Models' size (defaults to 1000)");
    sizeOption.setType(Number.class);
    sizeOption.setArgs(1);

    Option seedOption = OptionBuilder.create(SEED);
    seedOption.setLongOpt(SEED_LONG);
    seedOption.setArgName("seed");
    seedOption.setDescription("Seed number (random by default)");
    seedOption.setType(Number.class);
    seedOption.setArgs(1);

    options.addOption(metamodelOpt);
    options.addOption(additionalMetamodelOpt);
    options.addOption(outDirOpt);
    options.addOption(nModelsOpt);
    options.addOption(sizeOption);
    options.addOption(seedOption);
}

From source file:com.rabbitmq.perf.PerfTest.java

private static Options getOptions() {
    Options options = new Options();
    options.addOption(new Option("?", "help", false, "show usage"));
    options.addOption(new Option("d", "id", true, "test ID"));
    options.addOption(new Option("h", "uri", true, "connection URI"));
    options.addOption(new Option("t", "type", true, "exchange type"));
    options.addOption(new Option("e", "exchange", true, "exchange name"));
    options.addOption(new Option("u", "queue", true, "queue name"));
    options.addOption(new Option("k", "routingKey", true, "routing key"));
    options.addOption(new Option("K", "randomRoutingKey", false, "use random routing key per message"));
    options.addOption(new Option("i", "interval", true, "sampling interval in seconds"));
    options.addOption(new Option("r", "rate", true, "producer rate limit"));
    options.addOption(new Option("R", "consumerRate", true, "consumer rate limit"));
    options.addOption(new Option("x", "producers", true, "producer count"));
    options.addOption(new Option("y", "consumers", true, "consumer count"));
    options.addOption(new Option("m", "ptxsize", true, "producer tx size"));
    options.addOption(new Option("n", "ctxsize", true, "consumer tx size"));
    options.addOption(new Option("c", "confirm", true, "max unconfirmed publishes"));
    options.addOption(new Option("a", "autoack", false, "auto ack"));
    options.addOption(new Option("A", "multiAckEvery", true, "multi ack every"));
    options.addOption(new Option("q", "qos", true, "consumer prefetch count"));
    options.addOption(new Option("Q", "globalQos", true, "channel prefetch count"));
    options.addOption(new Option("s", "size", true, "message size in bytes"));
    options.addOption(new Option("z", "time", true, "run duration in seconds (unlimited by default)"));
    options.addOption(new Option("C", "pmessages", true, "producer message count"));
    options.addOption(new Option("D", "cmessages", true, "consumer message count"));
    Option flag = new Option("f", "flag", true, "message flag");
    flag.setArgs(Option.UNLIMITED_VALUES);
    options.addOption(flag);/*from w w  w  . ja  va2  s .com*/
    options.addOption(new Option("M", "framemax", true, "frame max"));
    options.addOption(new Option("b", "heartbeat", true, "heartbeat interval"));
    options.addOption(new Option("p", "predeclared", false, "allow use of predeclared objects"));
    return options;
}

From source file:com.google.api.ads.adwords.keywordoptimizer.KeywordOptimizer.java

/**
 * Creates the command line structure / options.
 *
 * @return the command line {@link Options}
 *//*  w  w w .j  ava2s  .co m*/
private static Options createCommandLineOptions() {
    Options options = new Options();

    OptionBuilder.withLongOpt("keyword-properties");
    OptionBuilder.withDescription("Location of the keyword-optimizer.properties file.");
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("file");
    options.addOption(OptionBuilder.create("kp"));

    OptionBuilder.withLongOpt("ads-properties");
    OptionBuilder.withDescription("Location of the ads.properties file.");
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("file");
    options.addOption(OptionBuilder.create("ap"));

    OptionBuilder.withLongOpt("help");
    OptionBuilder.withDescription("Shows this help screen.");
    OptionBuilder.withArgName("help");
    options.addOption(OptionBuilder.create("h"));

    OptionBuilder.withLongOpt("seed-keywords");
    OptionBuilder.withDescription("Use the given keywords (separated by spaces) as a seed for the optimization."
            + "\nNote: Only one seed-* option is allowed.");
    OptionBuilder.hasArg(true);
    OptionBuilder.hasArgs(Option.UNLIMITED_VALUES);
    OptionBuilder.withArgName("keywords");
    options.addOption(OptionBuilder.create("sk"));

    OptionBuilder.withLongOpt("seed-keywords-file");
    OptionBuilder.withDescription(
            "Use the keywords from the given file (one keyword per row) as a seed for the optimization."
                    + "\nNote: Only one seed-* option is allowed.");
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("file");
    options.addOption(OptionBuilder.create("skf"));

    OptionBuilder.withLongOpt("seed-terms");
    OptionBuilder
            .withDescription("Use the given search terms (separated by spaces) as a seed for the optimization."
                    + "\nNote: Only one seed-* option is allowed.");
    OptionBuilder.hasArg(true);
    OptionBuilder.hasArgs(Option.UNLIMITED_VALUES);
    OptionBuilder.withArgName("terms");
    options.addOption(OptionBuilder.create("st"));

    OptionBuilder.withLongOpt("seed-terms-file");
    OptionBuilder.withDescription("Use the search terms from the given file (one keyword per row) as a seed "
            + "for the optimization.\nNote: Only one seed-* option is allowed.");
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("file");
    options.addOption(OptionBuilder.create("stf"));

    OptionBuilder.withLongOpt("seed-urls");
    OptionBuilder.withDescription("Use the given urls (separated by spaces) to extract keywords as a seed for "
            + "the optimization.\nNote: Only one seed-* option is allowed.");
    OptionBuilder.hasArg(true);
    OptionBuilder.hasArgs(Option.UNLIMITED_VALUES);
    OptionBuilder.withArgName("urls");
    options.addOption(OptionBuilder.create("su"));

    OptionBuilder.withLongOpt("seed-urls-file");
    OptionBuilder
            .withDescription("Use the urls from the given file (one url per row) to extract keywords as a seed "
                    + "for the optimization.\nNote: Only one seed-* option is allowed.");
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("file");
    options.addOption(OptionBuilder.create("suf"));

    OptionBuilder.withLongOpt("seed-category");
    OptionBuilder.withDescription(
            "Use the given category (ID as defined @ https://goo.gl/xUEr6s) to get keywords as a seed "
                    + "for the optimization.\nNote: Only one seed-* option is allowed.");
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("id");
    options.addOption(OptionBuilder.create("sc"));

    OptionBuilder.withLongOpt("match-types");
    OptionBuilder.withDescription("Use the given keyword match types (EXACT, BROAD, PHRASE).");
    OptionBuilder.hasArg(true);
    OptionBuilder.hasArgs(3);
    OptionBuilder.withArgName("types");
    options.addOption(OptionBuilder.create("m"));

    OptionBuilder.withLongOpt("max-cpc");
    OptionBuilder.withDescription("Use the given maximum CPC (in USD, e.g., 5.0 for $5).");
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("double");
    options.addOption(OptionBuilder.create("cpc"));

    OptionBuilder.withLongOpt("locations");
    OptionBuilder.withDescription("Use the given locations IDs (ID as defined @ https://goo.gl/TA5E81) for "
            + "geo-targeted results.");
    OptionBuilder.hasArg(true);
    OptionBuilder.hasArgs(Option.UNLIMITED_VALUES);
    OptionBuilder.withArgName("ids");
    options.addOption(OptionBuilder.create("loc"));

    OptionBuilder.withLongOpt("languages");
    OptionBuilder.withDescription("Use the given locations IDs (ID as defined @ https://goo.gl/WWzifs) for "
            + "language-targeted results.");
    OptionBuilder.hasArg(true);
    OptionBuilder.hasArgs(Option.UNLIMITED_VALUES);
    OptionBuilder.withArgName("ids");
    options.addOption(OptionBuilder.create("lang"));

    OptionBuilder.withLongOpt("output");
    OptionBuilder.withDescription("Mode for outputting results (CONSOLE / CSV)\nNote: If set to CSV, then "
            + "option -of also has to be specified.");
    OptionBuilder.hasArg(true);
    OptionBuilder.hasArgs(2);
    OptionBuilder.withArgName("mode");
    options.addOption(OptionBuilder.create("o"));

    OptionBuilder.withLongOpt("output-file");
    OptionBuilder.withDescription("File to for writing output data (only needed if option -o is specified).");
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("file");
    options.addOption(OptionBuilder.create("of"));

    return options;
}

From source file:dk.statsbiblioteket.netark.dvenabler.Command.java

private static Options getOptions() {
    Options options = new Options();
    options.addOption("h", HELP, false, "Print help message and exit");
    options.addOption("v", VERBOSE, false, "Enable verbose output");
    options.addOption("l", LIST, false, "Lists fields in index");
    options.addOption("c", CONVERT, false, "Convert index with the given field adjustments");
    {/*from  w  w  w  .j a  v a2  s.c  om*/
        Option iOption = new Option("f", FIELDS, true,
                "The fields to adjust.\n" + "entry: fieldname(docvaluetype)\n" + "docvaluetype: " + "NONE"
                        + " | " + FieldInfo.DocValuesType.NUMERIC + "(numerictype) | "
                        + FieldInfo.DocValuesType.BINARY + " | " + FieldInfo.DocValuesType.SORTED + " | "
                        + FieldInfo.DocValuesType.SORTED_SET + "\n" + "numerictype: "
                        + FieldType.NumericType.INT + " | " + FieldType.NumericType.LONG + " | "
                        + FieldType.NumericType.FLOAT + " | " + FieldType.NumericType.DOUBLE + "\n"
                        + "Sample: title(SORTED) year(NUMERIC(INT)) author(SORTED_SET) deprecated(NONE)");
        iOption.setArgs(Option.UNLIMITED_VALUES);
        options.addOption(iOption);
    }
    {
        Option iOption = new Option("i", INPUT, true, "Input folder with Lucene index");
        iOption.setArgs(1);
        options.addOption(iOption);
    }
    {
        Option iOption = new Option("o", OUTPUT, true, "Destination folder for adjusted Lucene index");
        iOption.setArgs(1);
        options.addOption(iOption);
    }

    return options;
}