protected static String[] splitParameterFromRemainingOptions(
            String cliString) {
        String[] paramSplit = new String[2];
        cliString = cliString.trim();
        if (cliString.startsWith("\"") || cliString.startsWith("'")) {
            int endQuoteIndex = cliString.indexOf(cliString.charAt(0), 1);
            if (endQuoteIndex < 0) {
                throw new IllegalArgumentException(
                        "Quotes not terminated correctly.");
            }
            paramSplit[0] = cliString.substring(1, endQuoteIndex);
            paramSplit[1] = cliString.substring(endQuoteIndex + 1, cliString
                    .length());
        } else if (cliString.startsWith("(")) {
            int bracketsOpen = 1;
            int currPos = 1;
            int nextCloseIndex = cliString.indexOf(")", currPos);
            int nextOpenIndex = cliString.indexOf("(", currPos);
            while (bracketsOpen != 0) {
                if (nextCloseIndex < 0) {
                    throw new IllegalArgumentException("Brackets do not match.");
                } else if ((nextOpenIndex < 0)
                        || (nextCloseIndex < nextOpenIndex)) {
                    bracketsOpen--;
                    currPos = nextCloseIndex + 1;
                    nextCloseIndex = cliString.indexOf(")", currPos);
                } else {
                    bracketsOpen++;
                    currPos = nextOpenIndex + 1;
                    nextOpenIndex = cliString.indexOf("(", currPos);
                }
            }
            paramSplit[0] = cliString.substring(1, currPos - 1);
            paramSplit[1] = cliString.substring(currPos, cliString.length());
        } else {
            int firstSpaceIndex = cliString.indexOf(" ", 0);
            if (firstSpaceIndex >= 0) {
                paramSplit[0] = cliString.substring(0, firstSpaceIndex);
                paramSplit[1] = cliString.substring(firstSpaceIndex + 1,
                        cliString.length());
            } else {
                paramSplit[0] = cliString;
                paramSplit[1] = "";
            }
        }
        return paramSplit;
    }