private void runCommandLine() {
int rc = 0;
String help = "";
Control.initSingletonWithoutView();
Control control = Control.getSingleton();
// no view initialization
try {
control.getExtensionLoader().hookCommandLineListener(cmdLine);
if (cmdLine.isEnabled(CommandLine.HELP) || cmdLine.isEnabled(CommandLine.HELP2)) {
help = cmdLine.getHelp();
System.out.println(help);
} else {
control.runCommandLineNewSession(cmdLine.getArgument(CommandLine.NEW_SESSION));
try {
Thread.sleep(1000);
} catch (InterruptedException e) {}
}
rc = 0;
} catch (Exception e) {
log.error(e.getMessage());
System.out.println(e.getMessage());
rc = 1;
} finally {
control.shutdown(false);
log.info(Constant.PROGRAM_TITLE + " terminated.");
}
System.exit(rc);
}