public void run() throws SVNException {
if (!getSVNSyncEnvironment().getArguments().isEmpty()) {
for (Iterator commands = getSVNSyncEnvironment().getArguments().iterator(); commands.hasNext();) {
String commandName = (String) commands.next();
AbstractSVNCommand command = AbstractSVNCommand.getCommand(commandName);
if (command == null) {
getSVNSyncEnvironment().getErr().println("\"" + commandName + "\": unknown command.\n");
continue;
}
String help = SVNCommandUtil.getCommandHelp(command, getEnvironment().getProgramName(), true);
getSVNSyncEnvironment().getOut().println(help);
}
} else if (getSVNSyncEnvironment().isVersion()) {
String version = SVNCommandUtil.getVersion(getEnvironment(), getSVNSyncEnvironment().isQuiet());
getEnvironment().getOut().println(version);
getEnvironment().getOut().println(VERSION_HELP_FOOTER);
} else if (getSVNSyncEnvironment().getArguments().isEmpty()) {
Comparator commandComparator = new Comparator() {
public int compare(Object o1, Object o2) {
AbstractSVNCommand c1 = (AbstractSVNCommand) o1;
AbstractSVNCommand c2 = (AbstractSVNCommand) o2;
if (c1 instanceof SVNSyncCommand && c2 instanceof SVNSyncCommand) {
SVNSyncCommand syncCommand1 = (SVNSyncCommand) c1;
SVNSyncCommand syncCommand2 = (SVNSyncCommand) c2;
if (syncCommand1.getOutputPriority() != syncCommand2.getOutputPriority()) {
return syncCommand1.getOutputPriority() < syncCommand2.getOutputPriority() ? -1 : 1;
}
}
return c1.getName().compareTo(c2.getName());
}
};
String help = SVNCommandUtil.getGenericHelp(getEnvironment().getProgramName(), GENERIC_HELP_HEADER,
null, commandComparator);