System.exit(start(args));
}
static int start(String... args) {
assert args != null;
GenerateTask task;
try {
CommandLineParser parser = new BasicParser();
CommandLine cmd = parser.parse(OPTIONS, args);
TemplateGenerator generator = getGenerator(cmd);
DmdlSourceRepository repository = getRepository(cmd);
ClassLoader classLoader = getClassLoader(cmd);
task = new GenerateTask(generator, repository, classLoader);
} catch (Exception e) {
HelpFormatter formatter = new HelpFormatter();
formatter.setWidth(Integer.MAX_VALUE);
formatter.printHelp(
MessageFormat.format(
"java -classpath ... {0}",
Main.class.getName()),
OPTIONS,
true);
System.out.printf("output formats (specify in \"-%s\"):%n", OPT_FORMAT.getOpt());
System.out.printf(" %8s - %s%n", WorkbookFormat.DATA, "only data sheet (Excel97)");
System.out.printf(" %8s - %s%n", WorkbookFormat.RULE, "only rule sheet (Excel97)");
System.out.printf(" %8s - %s%n", WorkbookFormat.INOUT, "input/output data sheet (Excel97)");
System.out.printf(" %8s - %s%n", WorkbookFormat.INSPECT, "expected data and its rule sheets (Excel97)");
System.out.printf(" %8s - %s%n", WorkbookFormat.ALL, "input/output data and rule sheets (Excel97)");
System.out.printf(" %8s - %s%n", WorkbookFormat.DATAX, "only data sheet (Excel2007)");
System.out.printf(" %8s - %s%n", WorkbookFormat.RULEX, "only rule sheet (Excel2007)");
System.out.printf(" %8s - %s%n", WorkbookFormat.INOUTX, "input/output data sheet (Excel2007)");
System.out.printf(" %8s - %s%n", WorkbookFormat.INSPECTX, "expected data and its rule sheets (Excel2007)");
System.out.printf(" %8s - %s%n", WorkbookFormat.ALLX, "input/output data and rule sheets (Excel2007)");
e.printStackTrace(System.out);
return 1;
}
try {
task.process();
} catch (IOException e) {
e.printStackTrace(System.out);
return 1;
}
return 0;