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:kieker.tools.loggingTimestampConverter.LoggingTimestampConverterTool.java

@Override
protected void addAdditionalOptions(final Options options) {
    final Option option = new Option(FLAG_TIMESTAMPS_PARAMETER, "timestamps", true,
            "List of timestamps (UTC timezone) to convert");
    option.setArgName("timestamp1 ... timestampN");
    option.setRequired(false);
    option.setArgs(Option.UNLIMITED_VALUES);

    options.addOption(option);/*from   w  w w .  j a  v  a2s  .  co m*/
}

From source file:com.opengamma.integration.tool.marketdata.PortfolioHtsResolverTool.java

@Override
protected Options createOptions(boolean contextProvided) {

    Options options = super.createOptions(contextProvided);

    Option portfolioNameOption = new Option(PORTFOLIO_NAME_OPT, "name", true,
            "The name of the OpenGamma portfolio for which to resolve time series");
    portfolioNameOption.setRequired(true);
    options.addOption(portfolioNameOption);

    Option writeOption = new Option(WRITE_OPT, "write", false,
            "Actually persists the time series to the database if specified, otherwise pretty-prints without persisting");
    options.addOption(writeOption);/*  w  w  w  . j ava 2  s . co m*/

    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(s) of the time series data field(s)");
    options.addOption(timeSeriesDataFieldOption);

    return options;
}

From source file:net.orpiske.ssps.sdm.actions.Update.java

@Override
protected void processCommand(String[] args) {
    CommandLineParser parser = new PosixParser();

    options = new Options();

    options.addOption("h", "help", false, "prints the help");
    options.addOption(null, "rebuild-cache-only", false,
            "only rebuilds the cache without updating from the remote repository");

    Option reposOptions = OptionBuilder.withLongOpt("repositories").create();
    reposOptions.setArgs(255);/*from www.  j ava 2s. c  o  m*/
    reposOptions.setRequired(false);
    reposOptions.setDescription("the repository(ies) to update");
    options.addOption(reposOptions);

    try {
        cmdLine = parser.parse(options, args);
    } catch (ParseException e) {
        help(options, -1);
    }

    isHelp = cmdLine.hasOption("help");
    rebuildCacheOnly = cmdLine.hasOption("rebuild-cache-only");

    repositories = cmdLine.getOptionValues("repositories");
}

From source file:com.opengamma.integration.tool.portfolio.PortfolioLoaderTool.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, XML or ZIP)");
    filenameOption.setRequired(true);
    options.addOption(filenameOption);//from ww w  . j  a v a 2 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 assetClassOption = new Option(SECURITY_TYPE_OPT, "security", true,
            "The security type expected in the input CSV/XLS file (ignored if ZIP file is specified)");
    options.addOption(assetClassOption);

    Option mergePositionsOption = new Option(MERGE_POSITIONS_OPT, "merge", false,
            "Try to merge positions in the same security type within a portfolio node, adding trades from all");
    options.addOption(mergePositionsOption);

    Option keepCurrentPositionsOption = new Option(KEEP_CURRENT_POSITIONS_OPT, "keep", false,
            "Keep existing positions in the previous version of the portfolio and add the newly loaded positions");
    options.addOption(keepCurrentPositionsOption);

    Option ignoreVersionOption = new Option(IGNORE_VERSION_OPT, "ignoreversion", false,
            "Ignore the versioning hashes in METADATA.INI when reading from a ZIP file");
    options.addOption(ignoreVersionOption);

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

    Option structureOption = new Option(STRUCTURE_OPT, "structure", true,
            "A /-separated sequence of position attributes used to structure the portfolio(s) (e.g. trade-group/strategy");
    options.addOption(structureOption);

    return options;
}

From source file:eu.scape_project.tool.toolwrapper.core.ToolWrapperCommandline.java

/** Public empty constructor */
public ToolWrapperCommandline() {
    Option opt;
    options = new Options();
    opt = new Option("t", "toolspec", true, "toolspec file location");
    opt.setRequired(true);
    options.addOption(opt);//from   w ww  . ja  v  a  2 s  . c  om
    opt = new Option("o", "outDir", true, "directory where to put the generated artifacts");
    opt.setRequired(true);
    options.addOption(opt);
}

From source file:com.tc.cli.CommandLineBuilder.java

public void addOption(String opt, String description, Class<?> type, boolean isRequired) {
    Option option = new Option(opt, description);
    option.setType(type);// w w  w.  j a v a  2s  .  c o  m
    option.setRequired(isRequired);

    options.addOption(option);
}

From source file:com.tc.cli.CommandLineBuilder.java

public void addOption(String opt, String description, Class<?> type, boolean isRequired, String argName) {
    Option option = new Option(opt, description);
    option.setType(type);/*  w w w  .j a  va  2  s. c  om*/
    option.setRequired(isRequired);
    option.setArgName(argName);

    options.addOption(option);
}

From source file:com.ict.dtube.tools.command.topic.UpdateTopicSubCommand.java

@Override
public Options buildCommandlineOptions(Options options) {
    Option opt = new Option("b", "brokerAddr", true, "create topic to which broker");
    opt.setRequired(false);
    options.addOption(opt);//from  ww w  .j ava2s. co m

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

    opt = new Option("t", "topic", true, "topic name");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option("r", "readQueueNums", true, "set read queue nums");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("w", "writeQueueNums", true, "set write queue nums");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("p", "perm", true, "set topic's permission(W|R|WR)");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("o", "order", true, "set topic's order(true|false");
    opt.setRequired(false);
    options.addOption(opt);

    return options;
}

From source file:com.tc.cli.CommandLineBuilder.java

public void addOption(String opt, boolean hasArg, String description, Class<?> type, boolean isRequired) {
    Option option = new Option(opt, hasArg, description);
    option.setType(type);// www  .  j a va 2s.c  o m
    option.setRequired(isRequired);

    options.addOption(option);
}

From source file:com.tc.cli.CommandLineBuilder.java

public void addOption(String opt, boolean hasArg, String description, Class<?> type, boolean isRequired,
        String argName) {/* ww w. j  a  va 2 s .  c  om*/
    Option option = new Option(opt, hasArg, description);
    option.setType(type);
    option.setRequired(isRequired);
    option.setArgName(argName);

    options.addOption(option);
}