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:org.objectweb.proactive.examples.fastdeployment.Main.java

public void parseArguments(String[] args) {
    CommandLineParser parser = new PosixParser();

    Options options = new Options();
    options.addOption(Params.concurrency.sOpt, Params.concurrency.toString(), true, Params.concurrency.desc);
    options.addOption(Params.pause.sOpt, Params.pause.toString(), true, Params.pause.desc);

    Option descOption;// ww  w  . j  a v  a 2  s  . c om
    descOption = new Option(Params.descriptor.sOpt, Params.descriptor.toString(), true, Params.descriptor.desc);
    descOption.setArgs(Option.UNLIMITED_VALUES);
    options.addOption(descOption);

    Option vnOption;
    vnOption = new Option(Params.virtualNode.sOpt, Params.virtualNode.toString(), true,
            Params.virtualNode.desc);
    vnOption.setArgs(Option.UNLIMITED_VALUES);
    options.addOption(vnOption);

    CommandLine line = null;

    String arg;

    try {
        line = parser.parse(options, args);
    } catch (ParseException e) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("fast Deployment", options);
        System.exit(1);
    }

    Option[] pOptions = line.getOptions();
    for (Option pOption : pOptions) {
        if (pOption.getOpt().equals(Params.virtualNode.sOpt)) {
            for (String s : pOption.getValues()) {
                virtualNodes.add(s);
            }
        }

        if (pOption.getOpt().equals(Params.descriptor.sOpt)) {
            for (String s : pOption.getValues()) {
                descriptors.add(s);
            }
        }
    }

    arg = line.getOptionValue(Params.concurrency.sOpt);
    if (arg != null) {
        try {
            concurrency = new Integer(arg);
        } catch (NumberFormatException e) {
            logger.warn("Invalid option value " + arg);
        }
    }

    arg = line.getOptionValue(Params.pause.sOpt);
    if (arg != null) {
        try {
            pause = new Integer(arg);
        } catch (NumberFormatException e) {
            logger.warn("Invalid option value " + arg);
        }
    }
}

From source file:org.ow2.proactive.resourcemanager.utils.console.ResourceManagerController.java

protected OptionGroup addCommandLineOptions(Options options) {
    OptionGroup actionGroup = new OptionGroup();

    Option addNodesOpt = new Option("a", "addnodes", true, control + "Add nodes by their URLs");
    addNodesOpt.setArgName("node URLs");
    addNodesOpt.setRequired(false);/*w w  w . j  av a 2s  . c om*/
    addNodesOpt.setArgs(Option.UNLIMITED_VALUES);
    actionGroup.addOption(addNodesOpt);

    Option removeNodesOpt = new Option("d", "removenodes", true, control + "Remove nodes by their URLs");
    removeNodesOpt.setArgName("node URLs");
    removeNodesOpt.setRequired(false);
    removeNodesOpt.setArgs(Option.UNLIMITED_VALUES);
    actionGroup.addOption(removeNodesOpt);

    Option lockNodesOpt = new Option("locknodes", true, control + "Lock nodes by their URLs");
    lockNodesOpt.setArgName("node URLs");
    lockNodesOpt.setRequired(false);
    lockNodesOpt.setArgs(Option.UNLIMITED_VALUES);
    actionGroup.addOption(lockNodesOpt);

    Option unlockNodesOpt = new Option("unlocknodes", true, control + "Unlock nodes by their URLs");
    unlockNodesOpt.setArgName("node URLs");
    unlockNodesOpt.setRequired(false);
    unlockNodesOpt.setArgs(Option.UNLIMITED_VALUES);
    actionGroup.addOption(unlockNodesOpt);

    Option createNSOpt = new Option("cn", "createns", true, control + "Create new node sources");
    createNSOpt.setArgName("names");
    createNSOpt.setRequired(false);
    createNSOpt.setArgs(Option.UNLIMITED_VALUES);
    actionGroup.addOption(createNSOpt);

    Option infrastuctureOpt = new Option("i", "infrastructure", true,
            "Specify an infrastructure when node source is created");
    infrastuctureOpt.setArgName("params");
    infrastuctureOpt.setRequired(false);
    infrastuctureOpt.setOptionalArg(true);
    infrastuctureOpt.setArgs(Option.UNLIMITED_VALUES);
    options.addOption(infrastuctureOpt);

    Option policyOpt = new Option("p", "policy", true, "Specify a policy when node source is created");
    policyOpt.setArgName("params");
    policyOpt.setOptionalArg(true);
    policyOpt.setRequired(false);
    policyOpt.setArgs(Option.UNLIMITED_VALUES);
    options.addOption(policyOpt);

    Option listNodesOpt = new Option("ln", "listnodes", true, control
            + "List nodes handled by Resource Manager. Display is : NODESOURCE HOSTNAME STATE NODE_URL");
    listNodesOpt.setRequired(false);
    listNodesOpt.setOptionalArg(true);
    listNodesOpt.setArgName("nodeSourceName");
    actionGroup.addOption(listNodesOpt);

    Option listNSOpt = new Option("lns", "listns", false,
            control + "List node sources on Resource Manager. Display is : NODESOURCE TYPE");
    listNSOpt.setRequired(false);
    actionGroup.addOption(listNSOpt);

    Option topologyOpt = new Option("t", "topology", false, control + "Displays nodes topology.");
    topologyOpt.setRequired(false);
    actionGroup.addOption(topologyOpt);

    Option removeNSOpt = new Option("r", "removens", true, control + "Remove given node sources");
    removeNSOpt.setArgName("names");
    removeNSOpt.setRequired(false);
    removeNSOpt.setArgs(Option.UNLIMITED_VALUES);
    actionGroup.addOption(removeNSOpt);

    Option shutdownOpt = new Option("s", "shutdown", false, control + "Shutdown Resource Manager");
    shutdownOpt.setRequired(false);
    actionGroup.addOption(shutdownOpt);

    Option acopt = new Option("stats", "statistics", false,
            control + "Display some statistics about the Resource Manager");
    acopt.setRequired(false);
    acopt.setArgs(0);
    actionGroup.addOption(acopt);

    acopt = new Option("ma", "myaccount", false, control + "Display current user account informations");
    acopt.setRequired(false);
    acopt.setArgs(0);
    actionGroup.addOption(acopt);

    acopt = new Option("ua", "useraccount", false, control + "Display account information by username");
    acopt.setRequired(false);
    acopt.setArgs(1);
    acopt.setArgName("username");
    actionGroup.addOption(acopt);

    acopt = new Option("ni", "nodeinfo", true, control + "Display node information");
    acopt.setRequired(false);
    acopt.setArgs(1);
    acopt.setArgName("nodeURL");
    actionGroup.addOption(acopt);

    acopt = new Option("rc", "reloadconfig", false,
            control + "Reloads the resource manager permission policy and log4j config");
    acopt.setRequired(false);
    acopt.setArgs(0);
    actionGroup.addOption(acopt);

    options.addOptionGroup(actionGroup);

    Option nodeSourceNameOpt = new Option("ns", "nodesource", true,
            control + "Specify an existing node source name for adding nodes");
    nodeSourceNameOpt.setArgName("nodes URLs");
    nodeSourceNameOpt.setRequired(false);
    nodeSourceNameOpt.setArgs(1);
    options.addOption(nodeSourceNameOpt);

    Option preeemptiveRemovalOpt = new Option("f", "force", false,
            control + "Do not wait for busy nodes to be freed before "
                    + "nodes removal, node source removal and shutdown actions (-d, -r and -s)");
    preeemptiveRemovalOpt.setRequired(false);
    options.addOption(preeemptiveRemovalOpt);

    Option script = new Option("sf", "script", true,
            control + "Execute the given javascript file with optional arguments.");
    script.setArgName("filePath arg1=val1 arg2=val2 ...");
    script.setArgs(Option.UNLIMITED_VALUES);
    script.setOptionalArg(true);
    script.setRequired(false);
    options.addOption(script);

    script = new Option("env", "environment", true, "Execute the given script and go into interactive mode");
    script.setArgName("filePath");
    script.setRequired(false);
    script.setOptionalArg(true);
    options.addOption(script);

    Option opt = new Option("c", "credentials", true,
            "Path to the credentials (" + Credentials.getCredentialsPath() + ").");
    opt.setRequired(false);
    opt.setArgs(1);
    options.addOption(opt);

    return actionGroup;
}

From source file:org.ow2.proactive.scheduler.util.console.SchedulerController.java

protected OptionGroup addCommandLineOptions(Options options) {
    OptionGroup actionGroup = new OptionGroup();

    Option opt = new Option("s", "submit", true, control + "Submit the given job XML file");
    opt.setArgName("XMLDescriptor");
    opt.setRequired(false);/*w  w w . ja  v a 2  s.c om*/
    opt.setArgs(Option.UNLIMITED_VALUES);
    actionGroup.addOption(opt);

    opt = new Option("sa", "submitarchive", true, control + "Submit the given job archive");
    opt.setArgName("jobarchive");
    opt.setRequired(false);
    opt.setArgs(1);
    actionGroup.addOption(opt);

    opt = new Option("cmd", "command", false,
            control + "If mentionned, -submit argument becomes a command line, ie: -submit command args...");
    opt.setRequired(false);
    options.addOption(opt);
    opt = new Option("cmdf", "commandf", false, control
            + "If mentionned, -submit argument becomes a text file path containing command lines to schedule");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("ss", "selectscript", true,
            control + "Used with -cmd or -cmdf, specify a selection script");
    opt.setArgName("selectScript");
    opt.setRequired(false);
    opt.setArgs(1);
    options.addOption(opt);

    opt = new Option("jn", "jobname", true, control + "Used with -cmd or -cmdf, specify the job name");
    opt.setArgName("jobName");
    opt.setRequired(false);
    opt.setArgs(1);
    options.addOption(opt);

    opt = new Option("pj", "pausejob", true, control + "Pause the given job (pause every non-running tasks)");
    opt.setArgName("jobId");
    opt.setRequired(false);
    opt.setArgs(1);
    actionGroup.addOption(opt);

    opt = new Option("rj", "resumejob", true, control + "Resume the given job (restart every paused tasks)");
    opt.setArgName("jobId");
    opt.setRequired(false);
    opt.setArgs(1);
    actionGroup.addOption(opt);

    opt = new Option("kj", "killjob", true, control + "Kill the given job (cause the job to finish)");
    opt.setArgName("jobId");
    opt.setRequired(false);
    opt.setArgs(1);
    actionGroup.addOption(opt);

    opt = new Option("rmj", "removejob", true, control + "Remove the given job");
    opt.setArgName("jobId");
    opt.setRequired(false);
    opt.setArgs(1);
    actionGroup.addOption(opt);

    opt = new Option("pt", "preempttask", true,
            control + "Stop the given task and re-schedules it after specified delay.");
    opt.setArgName("jobId taskName delay");
    opt.setRequired(false);
    opt.setArgs(3);
    actionGroup.addOption(opt);

    opt = new Option("rt", "restarttask", true,
            control + "Terminate the given task and re-schedules it after specified delay.");
    opt.setArgName("jobId taskName delay");
    opt.setRequired(false);
    opt.setArgs(3);
    actionGroup.addOption(opt);

    opt = new Option("kt", "killtask", true, control + "Kill the given task.");
    opt.setArgName("jobId taskName");
    opt.setRequired(false);
    opt.setArgs(2);
    actionGroup.addOption(opt);

    opt = new Option("jr", "jobresult", true, control + "Get the result of the given job");
    opt.setArgName("jobId");
    opt.setRequired(false);
    opt.setArgs(1);
    actionGroup.addOption(opt);

    opt = new Option("tr", "taskresult", true, control + "Get the result of the given task");
    opt.setArgName("jobId taskName [inc]");
    opt.setRequired(false);
    opt.setArgs(3);
    opt.setOptionalArg(true);
    actionGroup.addOption(opt);

    opt = new Option("jo", "joboutput", true, control + "Get the output of the given job");
    opt.setArgName("jobId");
    opt.setRequired(false);
    opt.setArgs(2);
    actionGroup.addOption(opt);

    opt = new Option("to", "taskoutput", true, control + "Get the output of the given task");
    opt.setArgName("jobId taskName");
    opt.setRequired(false);
    opt.setArgs(2);
    actionGroup.addOption(opt);

    opt = new Option("jp", "jobpriority", true,
            control + "Change the priority of the given job (Idle, Lowest, Low, Normal, High, Highest)");
    opt.setArgName("jobId newPriority");
    opt.setRequired(false);
    opt.setArgs(2);
    actionGroup.addOption(opt);

    opt = new Option("js", "jobstate", true,
            control + "Get the current state of the given job (Also tasks description)");
    opt.setArgName("jobId");
    opt.setRequired(false);
    opt.setArgs(2);
    actionGroup.addOption(opt);

    opt = new Option("lj", "listjobs", false, control + "Display the list of jobs managed by the scheduler");
    opt.setRequired(false);
    opt.setArgs(0);
    actionGroup.addOption(opt);

    opt = new Option("stats", "statistics", false, control + "Display some statistics about the Scheduler");
    opt.setRequired(false);
    opt.setArgs(0);
    actionGroup.addOption(opt);

    opt = new Option("ma", "myaccount", false, control + "Display current user account information");
    opt.setRequired(false);
    opt.setArgs(0);
    actionGroup.addOption(opt);

    opt = new Option("ua", "useraccount", false, control + "Display account information by username");
    opt.setRequired(false);
    opt.setArgs(1);
    opt.setArgName("username");
    actionGroup.addOption(opt);

    opt = new Option("rc", "reloadconfig", false,
            control + "Reloads the scheduler permission policy and log4j config");
    opt.setRequired(false);
    opt.setArgs(0);
    actionGroup.addOption(opt);

    opt = new Option("sf", "script", true,
            control + "Execute the given javascript file with optional arguments.");
    opt.setArgName("filePath arg1=val1 arg2=val2 ...");
    opt.setRequired(false);
    opt.setArgs(Option.UNLIMITED_VALUES);
    opt.setOptionalArg(true);
    actionGroup.addOption(opt);

    opt = new Option("env", "environment", true,
            "Execute the given script as an environment for the interactive mode");
    opt.setArgName("filePath");
    opt.setRequired(false);
    opt.setArgs(1);
    actionGroup.addOption(opt);

    opt = new Option("test", false,
            control + "Test if the Scheduler is successfully started by committing some examples");
    opt.setRequired(false);
    opt.setArgs(0);
    actionGroup.addOption(opt);

    opt = new Option("c", "credentials", true,
            "Path to the credentials (" + Credentials.getCredentialsPath() + ").");
    opt.setRequired(false);
    opt.setOptionalArg(true);
    options.addOption(opt);

    options.addOptionGroup(actionGroup);

    opt = new Option("start", "schedulerstart", false, control + "Start the Scheduler");
    opt.setRequired(false);
    actionGroup.addOption(opt);

    opt = new Option("stop", "schedulerstop", false, control + "Stop the Scheduler");
    opt.setRequired(false);
    actionGroup.addOption(opt);

    opt = new Option("pause", "schedulerpause", false,
            control + "Pause the Scheduler (cause all non-running jobs to be paused)");
    opt.setRequired(false);
    actionGroup.addOption(opt);

    opt = new Option("freeze", "schedulerfreeze", false,
            control + "Freeze the Scheduler (cause all non-running tasks to be paused)");
    opt.setRequired(false);
    actionGroup.addOption(opt);

    opt = new Option("resume", "schedulerresume", false, control + "Resume the Scheduler");
    opt.setRequired(false);
    actionGroup.addOption(opt);

    opt = new Option("shutdown", "schedulershutdown", false, control + "Shutdown the Scheduler");
    opt.setRequired(false);
    actionGroup.addOption(opt);

    opt = new Option("kill", "schedulerkill", false, control + "Kill the Scheduler");
    opt.setRequired(false);
    actionGroup.addOption(opt);

    opt = new Option("lrm", "linkrm", true, control + "Reconnect a RM to the scheduler");
    opt.setArgName("rmURL");
    opt.setRequired(false);
    opt.setArgs(1);
    actionGroup.addOption(opt);

    opt = new Option("pr", "policyreload", false, control + "Reload the policy configuration");
    opt.setRequired(false);
    actionGroup.addOption(opt);

    opt = new Option("p", "policy", true, control + "Change the current scheduling policy");
    opt.setArgName("fullName");
    opt.setRequired(false);
    opt.setArgs(1);
    actionGroup.addOption(opt);

    opt = new Option("ll", "logs", true, control + "Get server logs of given job or task");
    opt.setArgName("jobId [taskName]");
    opt.setRequired(false);
    opt.setArgs(2);
    actionGroup.addOption(opt);

    options.addOptionGroup(actionGroup);

    return actionGroup;
}

From source file:org.ow2.proactive_grid_cloud_portal.cli.CommandSetTest.java

@Test
public void testThatArgNamesMatchNumberOfArgs() throws ParseException, IllegalAccessException {
    int nbArgsBasedOnName = Option.UNINITIALIZED;

    if (entry.argNames() != null) {
        String argNames = entry.argNames();

        if (entry.hasOptionalArg()) {
            // argNames description of optional arguments is assumed to start with '['
            argNames = argNames.substring(0, argNames.indexOf("["));
        }//from w w  w.  j  a va 2s . c o  m

        if (!argNames.trim().isEmpty()) {
            nbArgsBasedOnName = argNames.split(" ").length;
        }

        if (argNames.contains("...")) {
            nbArgsBasedOnName = Option.UNLIMITED_VALUES;
        }
    }

    Assert.assertEquals("Option '" + entry.longOpt() + "' does not have argNames matching number of args",
            entry.numOfArgs(), nbArgsBasedOnName);
}

From source file:org.seedstack.seed.core.internal.cli.CliModel.java

CliModel(Set<Field> fields) {
    for (Field field : fields) {
        CliOption optionAnnotation = field.getAnnotation(CliOption.class);
        CliArgs argsAnnotation = field.getAnnotation(CliArgs.class);

        if (optionAnnotation != null) {
            Option option = new Option(optionAnnotation.name(), optionAnnotation.longName(),
                    optionAnnotation.valueCount() > 0 || optionAnnotation.valueCount() == -1,
                    optionAnnotation.description());

            if (optionAnnotation.valueCount() == -1) {
                option.setArgs(Option.UNLIMITED_VALUES);
            } else if (optionAnnotation.valueCount() > 0) {
                option.setArgs(optionAnnotation.valueCount());
            }/* www .  ja  v a 2  s .  com*/

            option.setValueSeparator(optionAnnotation.valueSeparator());
            option.setRequired(optionAnnotation.mandatory());
            option.setOptionalArg(!optionAnnotation.mandatoryValue());
            optionAnnotations.add(optionAnnotation);
            optionFields.add(field);
            options.addOption(option);
        } else if (argsAnnotation != null) {
            mandatoryArgsCount = argsAnnotation.mandatoryCount();
            argsField = field;
        }
    }
}

From source file:org.springframework.amqp.rabbit.MulticastMain.java

private static Options getOptions() {
    Options options = new Options();
    options.addOption(new Option("?", "help", false, "show usage"));
    options.addOption(new Option("h", "host", true, "broker host"));
    options.addOption(new Option("p", "port", true, "broker port"));
    options.addOption(new Option("t", "type", true, "exchange type"));
    options.addOption(new Option("e", "exchange", true, "exchange name"));
    options.addOption(new Option("i", "interval", true, "sampling interval"));
    options.addOption(new Option("r", "rate", true, "rate limit"));
    options.addOption(new Option("N", "messages", true, "message count"));
    options.addOption(new Option("c", "connections", false, "share consumer connections"));
    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("a", "autoack", false, "auto ack"));
    options.addOption(new Option("q", "qos", true, "qos prefetch count"));
    options.addOption(new Option("s", "size", true, "message size"));
    options.addOption(new Option("z", "time", true, "time limit"));
    Option flag = new Option("f", "flag", true, "message flag");
    flag.setArgs(Option.UNLIMITED_VALUES);
    options.addOption(flag);//from   www  . ja  v a  2s . co m
    options.addOption(new Option("M", "framemax", true, "frame max"));
    options.addOption(new Option("b", "heartbeat", true, "heartbeat interval"));
    return options;
}

From source file:org.starschema.hadoop.yarn.applications.distributedshell.Client.java

Client(String appMasterMainClass, Configuration conf) {
    this.conf = conf;
    this.appMasterMainClass = appMasterMainClass;
    yarnClient = YarnClient.createYarnClient();
    yarnClient.init(conf);// w w  w  .  ja v a  2  s .c  om
    opts = new Options();
    opts.addOption("appname", true, "Application Name. Default value - DistributedShell");
    opts.addOption("priority", true, "Application Priority. Default 0");
    opts.addOption("queue", true, "RM Queue in which this application is to be submitted");
    opts.addOption("timeout", true, "Application timeout in milliseconds");
    opts.addOption("master_memory", true,
            "Amount of memory in MB to be requested to run the application master");
    opts.addOption("master_vcores", true,
            "Amount of virtual cores to be requested to run the application master");
    opts.addOption("jar", true, "Jar file containing the application master");
    opts.addOption("shell_command", true, "Shell command to be executed by "
            + "the Application Master. Can only specify either --shell_command " + "or --shell_script");
    opts.addOption("shell_script", true, "Location of the shell script to be "
            + "executed. Can only specify either --shell_command or --shell_script");
    opts.addOption("hazelcast_zip", true, "Location of the hazelcast zip.");
    opts.addOption("shell_args", true,
            "Command line args for the shell script." + "Multiple args can be separated by empty space.");
    opts.getOption("shell_args").setArgs(Option.UNLIMITED_VALUES);
    opts.addOption("shell_env", true, "Environment for shell script. Specified as env_key=env_val pairs");
    opts.addOption("shell_cmd_priority", true, "Priority for the shell command containers");
    opts.addOption("container_memory", true, "Amount of memory in MB to be requested to run the shell command");
    opts.addOption("container_vcores", true,
            "Amount of virtual cores to be requested to run the shell command");
    opts.addOption("num_containers", true, "No. of containers on which the shell command needs to be executed");
    opts.addOption("log_properties", true, "log4j.properties file");
    opts.addOption("keep_containers_across_application_attempts", false,
            "Flag to indicate whether to keep containers across application attempts."
                    + " If the flag is true, running containers will not be killed when"
                    + " application attempt fails and these containers will be retrieved by"
                    + " the new application attempt ");
    opts.addOption("attempt_failures_validity_interval", true,
            "when attempt_failures_validity_interval in milliseconds is set to > 0,"
                    + "the failure number will not take failures which happen out of "
                    + "the validityInterval into failure count. "
                    + "If failure count reaches to maxAppAttempts, " + "the application will be failed.");
    opts.addOption("debug", false, "Dump out debug information");
    opts.addOption("domain", true, "ID of the timeline domain where the " + "timeline entities will be put");
    opts.addOption("view_acls", true,
            "Users and groups that allowed to " + "view the timeline entities in the given domain");
    opts.addOption("modify_acls", true,
            "Users and groups that allowed to " + "modify the timeline entities in the given domain");
    opts.addOption("create", false,
            "Flag to indicate whether to create the " + "domain specified with -domain.");
    opts.addOption("help", false, "Print usage");
    opts.addOption("node_label_expression", true,
            "Node label expression to determine the nodes" + " where all the containers of this application"
                    + " will be allocated, \"\" means containers"
                    + " can be allocated anywhere, if you don't specify the option,"
                    + " default node_label_expression of queue will be used.");
}

From source file:org.trancecode.xproc.cli.CommandLineExecutor.java

protected CommandLineExecutor() {
    options = new Options();

    helpOption = new Option("h", "help", false, "Print help");
    options.addOption(helpOption);//from w  w w.  j  a v a  2  s.  c  o  m

    librariesOption = new Option("l", "library", true, "XProc pipeline library to load");
    librariesOption.setArgName("uri");
    librariesOption.setArgs(Option.UNLIMITED_VALUES);
    librariesOption.setType(URL.class);
    options.addOption(librariesOption);

    optionOption = new Option("o", "option", true, "Passes an option to the pipeline");
    optionOption.setArgName("name=value");
    optionOption.setArgs(2);
    optionOption.setValueSeparator('=');
    options.addOption(optionOption);

    paramOption = new Option("p", "param", true, "Passes a parameter to the pipeline");
    paramOption.setArgName("name=value");
    paramOption.setArgs(2);
    paramOption.setValueSeparator('=');
    options.addOption(paramOption);

    portBindingOption = new Option("b", "port-binding", true, "Binds a source port to the specified URI");
    portBindingOption.setArgName("name=uri");
    portBindingOption.setArgs(2);
    portBindingOption.setValueSeparator('=');
    options.addOption(portBindingOption);

    verboseOption = new Option("v", "verbose", false, "Display more information");
    options.addOption(verboseOption);

    versionOption = new Option("V", "version", false, "Print version and exit");
    options.addOption(versionOption);

    xplOption = new Option("x", "xpl", true, "XProc pipeline to load and run");
    xplOption.setArgName("uri");
    xplOption.setRequired(true);
    xplOption.setType(URL.class);
    options.addOption(xplOption);
}

From source file:org.uli.util.MyOptionBuilder.java

/**
 * The next Option created can have unlimited argument values.
 *
 * @return the OptionBuilder instance//from   w  w w . j a  v  a2 s  .c  o m
 */
public MyOptionBuilder hasArgs() {
    this.numberOfArgs = Option.UNLIMITED_VALUES;

    return this;
}

From source file:org.uli.util.MyOptionBuilder.java

/**
 * The next Option can have an unlimited number of optional arguments.
 *
 * @return the OptionBuilder instance//from   ww  w.  jav  a  2 s .c om
 */
public MyOptionBuilder hasOptionalArgs() {
    this.numberOfArgs = Option.UNLIMITED_VALUES;
    this.optionalArg = true;

    return this;
}