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

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

Introduction

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

Prototype

public String[] getValues() 

Source Link

Document

Return the values of this Option as a String array or null if there are no values

Usage

From source file:ro.cs.products.Executor.java

private static void printCommandLine(CommandLine cmd) {
    Logger.getRootLogger().debug("Executing with the following arguments:");
    for (Option option : cmd.getOptions()) {
        if (option.hasArgs()) {
            Logger.getRootLogger().debug(option.getOpt() + "=" + String.join(" ", option.getValues()));
        } else if (option.hasArg()) {
            Logger.getRootLogger().debug(option.getOpt() + "=" + option.getValue());
        } else {// www .ja v  a  2s . co  m
            Logger.getRootLogger().debug(option.getOpt());
        }
    }
}

From source file:ru.xxlabaza.popa.Main.java

@Override
public void run(String... args) throws Exception {
    val commandLine = parseArguments(args);
    for (Option option : commandLine.getOptions()) {
        commandsMap.get(option).execute(option.getValues());
    }/*ww  w . ja  v  a 2s.  co  m*/
    //        exit(0);
}