log.debug("processing arguments: " + Strings.join(args, ","));
if (args.length == 0) {
throw new CommandException("Command requires arguments");
}
String sopts = "-:";
LongOpt[] lopts =
{
// new LongOpt("count", LongOpt.NO_ARGUMENT, null, 'c'),
};
Getopt getopt = new Getopt(null, args, sopts, lopts);
getopt.setOpterr(false);
int code;
int argidx = 0;
while ((code = getopt.getopt()) != -1)
{
switch (code)
{
case ':":
throw new CommandException
("Option requires an argument: "+ args[getopt.getOptind() - 1]);
case '?":
throw new CommandException
("Invalid (or ambiguous) option: " + args[getopt.getOptind() - 1]);
// non-option arguments
case 1:
{
String arg = getopt.getOptarg();
switch (argidx++) {
default:
names.add(createObjectName(arg));
break;
}
break;
}
}
}