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

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

Introduction

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

Prototype

public String getValue() 

Source Link

Document

Returns the specified value of this Option or null if there is no value.

Usage

From source file:wvw.utils.cmd.CmdUtils.java

public String toString() {
    StringBuffer ret = new StringBuffer();
    ret.append("- parameters:\n");

    int cnt = 0;/*from   ww w .j a  va 2  s .c o m*/
    for (Object obj : processedOptions) {

        if (cnt++ > 0)
            ret.append("\n");

        if (obj instanceof Option) {
            Option option = (Option) obj;

            if (option.hasArg())
                ret.append(option.getOpt() + " : " + option.getValue());
            else
                ret.append(option.getOpt());

        } else if (obj instanceof CmdOptionVal) {
            CmdOptionVal option = (CmdOptionVal) obj;

            if (option.getOption().hasArg())
                ret.append(option.getName() + " : " + option.getValue());
            else
                ret.append(option.getName());
        }
    }

    ret.append("\n");

    return ret.toString();
}