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

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

Introduction

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

Prototype

public void setRequired(boolean required) 

Source Link

Document

Sets whether this Option is mandatory.

Usage

From source file:com.alibaba.rocketmq.tools.command.consumer.UpdateSubGroupSubCommand.java

@Override
public Options buildCommandlineOptions(Options options) {
    Option opt = new Option("b", "brokerAddr", true, "create subscription group to which broker");
    opt.setRequired(false);
    options.addOption(opt);/*from   w w  w. j a v a2s  .c o m*/

    opt = new Option("c", "clusterName", true, "create subscription group to which cluster");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("g", "groupName", true, "consumer group name");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option("s", "consumeEnable", true, "consume enable");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("m", "consumeFromMinEnable", true, "from min offset");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("d", "consumeBroadcastEnable", true, "broadcast");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("q", "retryQueueNums", true, "retry queue nums");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("r", "retryMaxTimes", true, "retry max times");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("i", "brokerId", true, "consumer from which broker id");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("w", "whichBrokerWhenConsumeSlowly", true, "which broker id when consume slowly");
    opt.setRequired(false);
    options.addOption(opt);

    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);//from  w ww .j  a va  2  s.c  om
    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:bvt.TestRunner.java

/**
 * Return supported command options.//  w ww  .ja v a2s. c  o m
 * @return org.apache.commons.cli.Options
 */
private Options getCommandOptions() {
    Options options = new Options();
    Option o;

    o = new Option("b", "brief", false, "Run the LexBIG test suite and produce a text report "
            + "with overall statistics and details for failed " + "tests only.");
    o.setRequired(false);
    options.addOption(o);

    o = new Option("f", "full", false, "Run the LexBIG test suite and produce an itemized "
            + "list of all tests with indication of success/failure.");
    o.setRequired(false);
    options.addOption(o);

    o = new Option("x", "xml", false, "Run the LexBIG test suite and produce a report with "
            + "extensive information for each test case in xml format.");
    o.setRequired(false);
    options.addOption(o);

    o = new Option("h", "html", false,
            "Run the LexBIG test suite and produce a report " + "suitable for view in a standard web browser.");
    o.setRequired(false);
    options.addOption(o);

    o = new Option("v", "verify", false,
            "Basic verification that LexEVS is configured properly " + "and basic systems are functioning.");
    o.setRequired(false);
    options.addOption(o);

    return options;
}

From source file:com.opengamma.integration.tool.portfolio.ResolvingPortfolioLoaderTool.java

@Override
protected Options createOptions(boolean contextProvided) {

    Options options = super.createOptions(contextProvided);

    Option filenameOption = new Option(FILE_NAME_OPT, "filename", true,
            "The path to the file containing data to import (CSV, XLS or ZIP)");
    filenameOption.setRequired(true);
    options.addOption(filenameOption);// ww w.  jav a2 s .c om

    Option portfolioNameOption = new Option(PORTFOLIO_NAME_OPT, "name", true,
            "The name of the destination OpenGamma portfolio");
    options.addOption(portfolioNameOption);

    Option writeOption = new Option(WRITE_OPT, "write", false,
            "Actually persists the portfolio to the database if specified, otherwise pretty-prints without persisting");
    options.addOption(writeOption);

    Option overwriteOption = new Option(OVERWRITE_OPT, "overwrite", false,
            "Deletes any existing matching securities, positions and portfolios and recreates them from input data");
    options.addOption(overwriteOption);

    Option verboseOption = new Option(VERBOSE_OPT, "verbose", false,
            "Displays progress messages on the terminal");
    options.addOption(verboseOption);

    Option timeSeriesDataProviderOption = new Option(TIME_SERIES_DATAPROVIDER_OPT, "provider", true,
            "The name of the time series data provider");
    options.addOption(timeSeriesDataProviderOption);

    Option timeSeriesDataFieldOption = new Option(TIME_SERIES_DATAFIELD_OPT, "field", true,
            "The name of the time series data field");
    options.addOption(timeSeriesDataFieldOption);

    return options;
}

From source file:com.opengamma.integration.marketdata.manipulator.dsl.SimulationTool.java

@Override
protected Options createOptions(boolean mandatoryConfigResource) {
    Options options = super.createOptions(mandatoryConfigResource);

    Option viewDefNameOption = new Option(VIEW_DEF_NAME_OPTION, true, "View definition name");
    viewDefNameOption.setRequired(true);
    viewDefNameOption.setArgName("viewdefname");
    options.addOption(viewDefNameOption);

    Option marketDataOption = new Option(MARKET_DATA_OPTION, true, "Market data source names");
    marketDataOption.setRequired(true);/*from w  w w.ja  v  a 2 s  . c  om*/
    marketDataOption.setArgName("marketdata");
    options.addOption(marketDataOption);

    Option simulationScriptOption = new Option(SIMULATION_SCRIPT_OPTION, true, "Simulation script location");
    simulationScriptOption.setRequired(true);
    simulationScriptOption.setArgName("simulationscript");
    options.addOption(simulationScriptOption);

    Option paramScriptOption = new Option(PARAMETER_SCRIPT_OPTION, true,
            "Simulation parameters script location");
    paramScriptOption.setArgName("simulationparameters");
    options.addOption(paramScriptOption);

    Option batchModeOption = new Option(BATCH_MODE_OPTION, false, "Run in batch mode");
    batchModeOption.setArgName("batchmode");
    options.addOption(batchModeOption);

    Option resultListenerClassOption = new Option(RESULT_LISTENER_CLASS_OPTION, true,
            "Result listener class " + "implementing ViewResultListener");
    resultListenerClassOption.setArgName("resultlistenerclass");
    options.addOption(resultListenerClassOption);

    return options;
}

From source file:datascript.backend.java.JavaExtension.java

public void getOptions(org.apache.commons.cli.Options rdsOptions) {
    org.apache.commons.cli.Option rdsOption;

    rdsOption = new Option("pkg", true,
            "\"packagename\"\tJava package name for types without a DataScript package");
    rdsOption.setRequired(false);
    rdsOptions.addOption(rdsOption);//from  w  w w . j  av  a2 s.c  o m

    rdsOption = new Option("java_e", false,
            "enables throwing exceptions in equals() function, when objects are not equal");
    rdsOption.setRequired(false);
    rdsOptions.addOption(rdsOption);
}

From source file:datascript.emit.html.HtmlExtension.java

public void getOptions(org.apache.commons.cli.Options rdsOptions) {
    Option rdsOption;

    rdsOption = new Option("doc", true, "enables generation of Javadoc-style documentation. "
            + "Optionaly you can specify a path to a output directory." + "Default directory name is 'html'.");
    rdsOption.setRequired(false);
    rdsOptions.addOption(rdsOption);/*from  w w w .j ava 2  s  . co m*/
}

From source file:com.alibaba.rocketmq.tools.command.message.PrintMessageByQueueCommand.java

@Override
public Options buildCommandlineOptions(Options options) {
    Option opt = new Option("t", "topic", true, "topic name");
    opt.setRequired(true);
    options.addOption(opt);/*from  w ww. j  av  a  2  s . c  o  m*/

    opt = new Option("a", "brokerName ", true, "broker name");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option("i", "queueId ", true, "queue id");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option("c", "charsetName ", true, "CharsetName(eg: UTF-8,GBK)");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("s", "subExpression ", true, "Subscribe Expression(eg: TagA || TagB)");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("b", "beginTimestamp ", true,
            "Begin timestamp[currentTimeMillis|yyyy-MM-dd#HH:mm:ss:SSS]");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("e", "endTimestamp ", true, "End timestamp[currentTimeMillis|yyyy-MM-dd#HH:mm:ss:SSS]");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("p", "print msg", true, "print msg. eg: true | false(default)");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("d", "printBody ", true, "print body. eg: true | false(default)");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("f", "calculate", true, "calculate by tag. eg: true | false(default)");
    opt.setRequired(false);
    options.addOption(opt);

    return options;
}

From source file:com.opengamma.integration.tool.portfolio.PortfolioTemplateCreationTool.java

protected Options createOptions() {

    Options options = new Options();

    String securityTypes = "";
    for (String s : s_securityTypes) {
        securityTypes += " " + s;
    }/*  w  ww. j  av a 2 s  . c o  m*/
    Option assetClassOption = new Option(SECURITY_TYPE_OPT, "securitytype", true,
            "The security type(s) for which to generate a template, or 'all' to create a template for each available security type: "
                    + securityTypes);
    assetClassOption.setRequired(true);
    options.addOption(assetClassOption);

    Option helpOption = new Option(HELP_OPTION, "help", false, "prints this message");
    options.addOption(helpOption);

    Option logbackOption = new Option(LOGBACK_OPTION, "logback", true, "Logback (ignored)");
    options.addOption(logbackOption);

    return options;
}

From source file:com.soulgalore.crawler.run.CrawlToCsv.java

/**
 * Get the options./*  w ww  . j  a  v  a2  s  .com*/
 * 
 * @return the specific CrawlToCsv options
 */
@Override
protected Options getOptions() {
    final Options options = super.getOptions();

    final Option filenameOption = new Option("f",
            "the name of the csv output file, default name is " + DEFAULT_FILENAME + " [optional]");
    filenameOption.setArgName("FILENAME");
    filenameOption.setLongOpt("filename");
    filenameOption.setRequired(false);
    filenameOption.setArgs(1);

    options.addOption(filenameOption);

    return options;

}