showHelp();
return;
}
String[] firstArg = new String[1];
firstArg[0] = args[0];
ArgumentHandler argumentHandler = new ArgumentHandler(firstArg);
HelpArguments helpArguments;
try {
helpArguments = argumentHandler.getInstance(HelpArguments.class);
} catch (InvalidArgumentsException e) {
System.err.println(e.getMessage());
showHelp();
return;
}
if (helpArguments.getShowHelp()) {
showHelp();
return;
}
argumentHandler.processArguments(new ArgumentProcessor() {
/**
* @see org.wymiwyg.commons.util.arguments.ArgumentProcessor#process(java.util.List)
*/
public void process(List<String> argumentList) {
if (argumentList.size() > 0) {
command = (String) argumentList.get(0);
if (command.equals("diff") || command.equals("leanify") || command.equals("patch")) {
argumentList.remove(0);
}
} else {
showHelp();
return;
}
}
});
if (command == null) {
System.err.println("must specify a command");
showHelp();
return;
}
String[] restArgs = new String[args.length -1];
System.arraycopy(args, 1,restArgs, 0, restArgs.length);
if ("diff".equals(command)) {
DiffMain.main("java -jar rdf-utils.jar diff", new ArgumentHandler(restArgs));
return;
}
if ("leanify".equals(command)) {
LeanifyMain.main("java -jar rdf-utils.jar leanify", new ArgumentHandler(restArgs));
return;
}
if ("patch".equals(command)) {
PatchMain.main("java -jar rdf-utils.jar patch", new ArgumentHandler(restArgs));
return;
}
showHelp();
}