curArg = curArg.substring(2);
else
curArg = curArg.substring(1);
// check if option is a valid one
CmdLineOption curOption = CmdLineOptionUtils.getOptionByName(
curArg, validOptions);
if (curOption == null)
throw new IOException("Invalid option '" + curArg + "'");
// check if option has arguments
List<String> values = new LinkedList<String>();
if (curOption.hasArgs()) {
while (j + 1 < args.length && !args[j + 1].startsWith("-"))
values.add(args[++j]);
if (values.size() < 1)
throw new IOException("Option " + curArg
+ " should have at least one argument");
}
//check if is a perform and quit option
if (curOption.isPerformAndQuit()) {
curOption.getHandler().handleOption(curOption, values);
System.exit(0);
}
// add to list of option instances
optionInstances