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

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

Introduction

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

Prototype

public void setArgs(int num) 

Source Link

Document

Sets the number of argument values this Option can take.

Usage

From source file:com.emc.ecs.util.OptionBuilder.java

public Option create(String opt) {
    // create the option
    Option option = new Option(opt, description);

    // set the option properties
    option.setLongOpt(longOpt);//from  w ww. j  a  v a 2 s . c om
    option.setArgs(argNum);
    option.setValueSeparator(valueSep);
    option.setArgName(argName);
    return option;
}

From source file:com.zimbra.cs.mailbox.calendar.FixCalendarEndTimeUtil.java

protected void setupCommandLineOptions() {
    super.setupCommandLineOptions();
    Options options = getOptions();//  w w  w  .j a v  a 2  s .c o m
    Option accountOpt = new Option(O_ACCOUNT, "account", true,
            "account email addresses seperated by white space or \"all\" for all accounts");
    accountOpt.setArgs(Option.UNLIMITED_VALUES);
    options.addOption(accountOpt);
    options.addOption(new Option(null, O_SYNC, false, "run synchronously; default is asynchronous"));
    options.addOption(SoapCLI.OPT_AUTHTOKEN);
    options.addOption(SoapCLI.OPT_AUTHTOKENFILE);
}

From source file:com.trackplus.tools.DBConnectionTester.java

private Option newOption(String shortOption, String description, String longOption, String argumentName) {
    Option option = new Option(shortOption, description);
    option.setLongOpt(longOption);//  ww  w  .j a v  a 2  s  .co m
    option.setArgs(1);
    option.setArgName(argumentName);

    return option;
}

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);
    reposOptions.setRequired(false);/*from  w ww.ja  v  a2  s . c om*/
    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:fr.inrialpes.exmo.align.cli.CommonCLI.java

protected Option createRequiredOption(String name, String longName, String desc, String argName) {
    Option opt = createOption(name, longName, desc);
    opt.setArgs(1);
    opt.setArgName(argName);//w ww  .  j a v a  2  s  . co  m
    return opt;
}

From source file:fr.inrialpes.exmo.align.cli.CommonCLI.java

public CommonCLI() {
    parameters = new Properties();
    options = new Options();
    options.addOption(createOption("h", "help", "Print this page"));
    options.addOption(createRequiredOption("o", "output", "Send output to FILE", "FILE"));
    options.addOption(createOptionalOption("d", "debug",
            "debug argument is deprecated, use logging instead\nSee http://alignapi.gforge.inria.fr/logging.html",
            "LEVEL"));
    options.addOption(createRequiredOption("P", "params", "Read parameters from FILE", "FILE"));
    // Special one
    Option opt = new Option("D", "Use value for given property");
    opt.setArgs(2);
    opt.setValueSeparator('=');
    opt.setArgName("NAME=VALUE");
    options.addOption(opt);/*from   www .  j  a  va  2  s  .co m*/
}

From source file:at.ac.tuwien.ims.latex2mobiformulaconv.converter.html2mobi.AmazonHtmlToMobiConverter.java

@Override
public Option getExecOption() {
    Option option = new Option("k", "kindlegen-exec", true, "Amazon KindleGen executable location");
    option.setArgs(1);
    return option;
}

From source file:com.basistech.lucene.tools.LuceneQueryTool.java

private static Options createOptions() {
    Options options = new Options();
    Option option;

    option = new Option("i", "index", true, "index (required, multiple -i searches multiple indexes)");
    option.setRequired(true);//from  w  ww  .  ja v a 2s  .  c o  m
    options.addOption(option);

    option = new Option("q", "query", true,
            "(query | %all | %enumerate-fields " + "| %count-fields " + "| %enumerate-terms field "
                    + "| %script scriptFile "
                    + "| %ids id [id ...] | %id-file file) (required, scriptFile may contain -q and -o)");
    option.setRequired(true);
    option.setArgs(Option.UNLIMITED_VALUES);
    options.addOption(option);

    option = new Option(null, "regex", true, "filter query by regex, syntax is field:/regex/");
    option.setArgs(1);
    options.addOption(option);

    option = new Option(null, "fields", true, "fields to include in output (defaults to all)");
    option.setArgs(Option.UNLIMITED_VALUES);
    options.addOption(option);

    option = new Option(null, "sort-fields", false, "sort fields within document");
    options.addOption(option);

    option = new Option(null, "query-limit", true, "max number of query hits to process");
    option.setArgs(1);
    options.addOption(option);

    option = new Option(null, "output-limit", true, "max number of docs to output");
    option.setArgs(1);
    options.addOption(option);

    option = new Option(null, "analyzer", true,
            "for query, (KeywordAnalyzer | StandardAnalyzer) (defaults to KeywordAnalyzer)");
    option.setArgs(1);
    options.addOption(option);

    option = new Option(null, "query-field", true, "default field for query");
    option.setArgs(1);
    options.addOption(option);

    option = new Option(null, "show-id", false, "show Lucene document id in results");
    options.addOption(option);

    option = new Option(null, "show-score", false, "show score in results");
    options.addOption(option);

    option = new Option(null, "show-hits", false, "show total hit count");
    options.addOption(option);

    option = new Option(null, "suppress-names", false, "suppress printing of field names");
    options.addOption(option);

    option = new Option(null, "tabular", false,
            "print tabular output " + "(requires --fields with no multivalued fields)");
    options.addOption(option);

    option = new Option("o", "output", true, "output file (defaults to standard output)");
    option.setArgs(1);
    options.addOption(option);

    return options;
}

From source file:at.ac.tuwien.ims.latex2mobiformulaconv.converter.latex2html.PandocLatexToHtmlConverter.java

@Override
public Option getExecOption() {
    Option pandocOption = new Option("p", "pandoc-exec", true, "pandoc executable location");
    pandocOption.setArgs(1);
    return pandocOption;
}

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);//from  w  w w  .j  a  v a 2s . c  om
    option.setArgs(Option.UNLIMITED_VALUES);

    options.addOption(option);
}