1.1 --- a/java/alt2xml-cli/src/cz/frantovo/alt2xml/cli/CLIStarter.java Thu Jul 03 00:18:35 2014 +0200
1.2 +++ b/java/alt2xml-cli/src/cz/frantovo/alt2xml/cli/CLIStarter.java Thu Jul 03 00:37:38 2014 +0200
1.3 @@ -43,9 +43,8 @@
1.4 public static void main(String[] args) {
1.5
1.6 try {
1.7 - File inputFile = new File(args[0]);
1.8 - String actionCode = args[1];
1.9 - OutputStream outputStream = System.out;
1.10 + CLIParser cliParser = new CLIParser();
1.11 + CLIOptions cliOptions = cliParser.parseOptions(args);
1.12
1.13 Map<String, ActionFactory> actionFactories = new HashMap<>();
1.14
1.15 @@ -55,19 +54,20 @@
1.16 log.log(Level.CONFIG, "Discovered output module: {0} = {1}", new Object[]{code, f.getClass().getName()});
1.17 }
1.18
1.19 + String actionCode = cliOptions.getAction();
1.20 ActionFactory actionFactory = actionFactories.get(actionCode);
1.21
1.22 if (actionFactory == null) {
1.23 log.log(Level.SEVERE, "No such output action with code: {0}", actionCode);
1.24 } else {
1.25
1.26 - ActionContext actionContext = new ActionContext(outputStream);
1.27 + ActionContext actionContext = new ActionContext(cliOptions.getOutputStream());
1.28 Action action = actionFactory.getAction(actionContext);
1.29
1.30 SAXParserFactory t = SAXParserFactory.newInstance();
1.31 SAXParser p = t.newSAXParser();
1.32
1.33 - action.run(p, new InputSource(inputFile.toURI().toASCIIString()));
1.34 + action.run(p, cliOptions.getInputSource());
1.35 }
1.36
1.37 } catch (Exception e) {