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:br.usp.poli.lta.cereda.spa2run.Utils.java

public static Options getOptions() {
    Options options = new Options();
    Option instrumentation = new Option("i", "instrumentation");
    instrumentation.setArgs(Option.UNLIMITED_VALUES);
    instrumentation.setDescription("instrumentation files");
    options.addOption(instrumentation);//from   ww w  .j a  v a 2  s. c o  m
    return options;
}

From source file:com.linkedin.python.importer.ImporterCLI.java

private static Options createOptions() {
    Option repo = Option.builder().longOpt("repo").numberOfArgs(1).argName("file")
            .desc("location of the ivy repo").build();

    Option replacement = Option.builder().longOpt("replace").numberOfArgs(Option.UNLIMITED_VALUES)
            .argName("replacement").desc("Noted like orig:version=replace:version").valueSeparator(',').build();

    Option quite = Option.builder().longOpt("quite").numberOfArgs(0).desc("Sets logging level to WARN").build();

    Options options = new Options();
    options.addOption(replacement);//from   w  w w  .  ja  va 2 s  . com
    options.addOption(repo);
    options.addOption(quite);
    return options;
}

From source file:com.geeksaga.light.console.Main.java

private Options getOptions() {
    Option bootStrapOption = new Option("b", "bootstrap", true, "library append to class loader of bootstrap");
    bootStrapOption.setArgs(Option.UNLIMITED_VALUES);
    bootStrapOption.setArgName("library path");

    Option attachOption = new Option("a", "attach", true, "attach java process");
    attachOption.setArgs(Option.UNLIMITED_VALUES);
    attachOption.setArgName("process ID");

    Option processOption = new Option("p", "process", false, "find java process");

    Options options = new Options();
    options.addOption(bootStrapOption);/*from w  w  w  .java  2  s . c om*/
    options.addOption(attachOption);
    options.addOption(processOption);

    return options;
}

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

protected void setupCommandLineOptions() {
    super.setupCommandLineOptions();
    Options options = getOptions();//w w  w  .ja v  a 2s. c  om
    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.github.dmyersturnbull.transformations.CommandLineHelperTest.java

@Test
public void testMultiargs() throws Exception {
    Optional<ExtendedCommandLine> cl = new CommandLineHelper()
            .addOptions(//w  ww .j  a  v a  2  s  . c om
                    Option.builder().argName("t").longOpt("t").numberOfArgs(Option.UNLIMITED_VALUES).build())
            .parse("-t", "1", "-t", "2", "-t", "3");
    assertTrue(cl.isPresent());
    assertEquals(Arrays.asList(1, 2, 3), cl.get().getListOf("t", Integer::new));
}

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 va2s . co  m
    option.setArgs(Option.UNLIMITED_VALUES);

    options.addOption(option);
}

From source file:com.geeksaga.light.tools.Main.java

private Options getOptions() {
    Option attachOption = new Option("a", "attach", true, "attach java process");
    attachOption.setArgs(Option.UNLIMITED_VALUES);
    attachOption.setArgName("process ID");

    Options options = new Options();
    options.addOption(attachOption);//from   w ww.  j  a  va  2  s. co m
    options.addOption(new Option("p", "process", false, "find java process"));
    options.addOption(new Option("s", "self", false, "self attach java process"));

    return options;
}

From source file:hrytsenko.gscripts.AppArgs.java

private static Option createOption(String name, String description, boolean required) {
    Option option = new Option(name, true, description);
    option.setArgs(Option.UNLIMITED_VALUES);
    option.setRequired(required);/*from  www.j  a va  2s.  c  o m*/
    return option;
}

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

@Override
protected void setupCommandLineOptions() {
    super.setupCommandLineOptions();
    Options options = getOptions();//from  ww  w  .  j av a  2  s  .c om
    Option rulefileOpt = new Option(null, O_RULEFILE, true, "xml file containing fixup rules");
    rulefileOpt.setRequired(true);
    options.addOption(rulefileOpt);
    Option accountOpt = new Option(O_ACCOUNT, "account", true,
            "account email addresses seperated by white space or \"all\" for all accounts");
    accountOpt.setRequired(true);
    accountOpt.setArgs(Option.UNLIMITED_VALUES);
    options.addOption(accountOpt);
    options.addOption(new Option(null, O_AFTER, true,
            "fixup calendar items after this time; defaults to beginning of 2007"));
    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:lu.uni.adtool.tools.Clo.java

public Clo() {
    this.options = new org.apache.commons.cli.Options();
    this.options.addOption("h", "help", false, Options.getMsg("clo.help.txt"));
    this.options.addOption("v", "version", false, Options.getMsg("clo.version.txt"));
    //     this.options.addOption("a", "all-domains", false, Options.getMsg("clo.allDomains.txt"));
    this.options.addOption("D", "no-derived", false, Options.getMsg("clo.derived.txt"));
    this.options.addOption("m", "mark-editable", false, Options.getMsg("clo.markEditable.txt"));
    this.options.addOption("L", "no-labels", false, Options.getMsg("clo.labels.txt"));
    this.options.addOption("C", "no-computed", false, Options.getMsg("clo.computed.txt"));
    // this.options.addOption("r", "rank", false,
    // Options.getMsg("clo.rank.txt"));

    Option option = new Option("o", "open", true, Options.getMsg("clo.open.txt"));
    // Set option c to take 1 to oo arguments
    option.setArgs(Option.UNLIMITED_VALUES);
    option.setArgName("file_1>...<file_N");
    this.options.addOption(option);
    option = new Option("i", "import", true, Options.getMsg("clo.import.txt"));
    option.setArgName("file");
    this.options.addOption(option);
    option = new Option("x", "export", true, Options.getMsg("clo.export.txt"));
    option.setArgName("file");
    this.options.addOption(option);
    option = new Option("d", "domain", true, Options.getMsg("clo.domain.txt"));
    //     option.setValueSeparator(',');
    //     option.setArgs(1);
    option.setArgName("domainID");
    this.options.addOption(option);
    option = new Option("r", "rank", true, Options.getMsg("clo.rank.txt"));
    option.setArgs(1);//from  w  ww  .j  a va 2  s.com
    option.setArgName("rankNo");
    this.options.addOption(option);
    option = new Option("s", "size", true, Options.getMsg("clo.size.txt"));
    option.setArgs(1);
    option.setArgName("X>x<Y");
    this.options.addOption(option);
    this.toOpen = null;
}