List of usage examples for org.apache.commons.cli BasicParser BasicParser
BasicParser
From source file:com.curecomp.primefaces.migrator.PrimefacesMigration.java
public static void main(String[] args) throws Exception { // Let's use some colors :) // AnsiConsole.systemInstall(); CommandLineParser cliParser = new BasicParser(); CommandLine cli = null;/* ww w. j a va 2 s . c o m*/ try { cli = cliParser.parse(OPTIONS, args); } catch (ParseException e) { printHelp(); } if (!cli.hasOption("s")) { printHelp(); } String sourcePattern; if (cli.hasOption("p")) { sourcePattern = cli.getOptionValue("p"); } else { sourcePattern = DEFAULT_SOURCE_PATTERN; } String defaultAnswer; if (cli.hasOption("default-answer")) { defaultAnswer = cli.getOptionValue("default-answer"); } else { defaultAnswer = DEFAULT_DEFAULT_PROMPT_ANSWER; } boolean defaultAnswerYes = defaultAnswer.equalsIgnoreCase("y"); boolean quiet = cli.hasOption("q"); boolean testWrite = cli.hasOption("t"); Path sourceDirectory = Paths.get(cli.getOptionValue("s")).toAbsolutePath(); // Since we use IO we will have some blocking threads hanging around int threadCount = Runtime.getRuntime().availableProcessors() * 2; ThreadPoolExecutor threadPool = new ThreadPoolExecutor(threadCount, threadCount, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>()); BlockingQueue<WidgetVarLocation> foundUsages = new LinkedBlockingQueue<>(); BlockingQueue<WidgetVarLocation> unusedOrAmbiguous = new LinkedBlockingQueue<>(); BlockingQueue<WidgetVarLocation> skippedUsages = new LinkedBlockingQueue<>(); List<Future<?>> futures = new ArrayList<>(); findWidgetVars(sourceDirectory, sourcePattern, threadPool).forEach(widgetVarLocation -> { // We can't really find usages of widget vars that use EL expressions :( if (widgetVarLocation.widgetVar.contains("#")) { unusedOrAmbiguous.add(widgetVarLocation); return; } try { FileActionVisitor visitor = new FileActionVisitor(sourceDirectory, sourcePattern, sourceFile -> futures.add(threadPool.submit((Callable<?>) () -> { findWidgetVarUsages(sourceFile, widgetVarLocation, foundUsages, skippedUsages, unusedOrAmbiguous); return null; }))); Files.walkFileTree(sourceDirectory, visitor); } catch (IOException ex) { throw new RuntimeException(ex); } }); awaitAll(futures); new TreeSet<>(skippedUsages).forEach(widgetUsage -> { int startIndex = widgetUsage.columnNr; int endIndex = startIndex + widgetUsage.widgetVar.length(); String relativePath = widgetUsage.location.toAbsolutePath().toString() .substring(sourceDirectory.toString().length()); String previous = replace(widgetUsage.line, startIndex, endIndex, Ansi.ansi().bold().fg(Ansi.Color.RED).a(widgetUsage.widgetVar).reset().toString()); System.out.println("Skipped " + relativePath + " at line " + widgetUsage.lineNr + " and col " + widgetUsage.columnNr + " for widgetVar '" + widgetUsage.widgetVar + "'"); System.out.println("\t" + previous); }); Map<WidgetVarLocation, List<WidgetVarLocation>> written = new HashMap<>(); new TreeSet<>(foundUsages).forEach(widgetUsage -> { WidgetVarLocation key = new WidgetVarLocation(null, widgetUsage.location, widgetUsage.lineNr, -1, null); List<WidgetVarLocation> writtenList = written.get(key); int existing = writtenList == null ? 0 : writtenList.size(); int startIndex = widgetUsage.columnNr; int endIndex = startIndex + widgetUsage.widgetVar.length(); String relativePath = widgetUsage.location.toAbsolutePath().toString() .substring(sourceDirectory.toString().length()); String next = replace(widgetUsage.line, startIndex, endIndex, Ansi.ansi().bold().fg(Ansi.Color.RED) .a("PF('" + widgetUsage.widgetVar + "')").reset().toString()); System.out .println(relativePath + " at line " + widgetUsage.lineNr + " and col " + widgetUsage.columnNr); System.out.println("\t" + next); System.out.print("Replace (Y/N)? [" + (defaultAnswerYes ? "Y" : "N") + "]: "); String input; if (quiet) { input = ""; System.out.println(); } else { try { do { input = in.readLine(); } while (input != null && !input.isEmpty() && !"y".equalsIgnoreCase(input) && !"n".equalsIgnoreCase(input)); } catch (IOException ex) { throw new RuntimeException(ex); } } if (input == null) { System.out.println("Aborted!"); } else if (input.isEmpty() && defaultAnswerYes || !input.isEmpty() && !"n".equalsIgnoreCase(input)) { System.out.println("Replaced!"); System.out.print("\t"); if (writtenList == null) { writtenList = new ArrayList<>(); written.put(key, writtenList); } writtenList.add(widgetUsage); List<String> lines; try { lines = Files.readAllLines(widgetUsage.location); } catch (IOException ex) { throw new RuntimeException(ex); } try (OutputStream os = testWrite ? new ByteArrayOutputStream() : Files.newOutputStream(widgetUsage.location); PrintWriter pw = new PrintWriter(new OutputStreamWriter(os, StandardCharsets.UTF_8))) { String line; for (int i = 0; i < lines.size(); i++) { int lineNr = i + 1; line = lines.get(i); if (lineNr == widgetUsage.lineNr) { int begin = widgetUsage.columnNr + (testWrite ? 0 : existing * 6); int end = begin + widgetUsage.widgetVar.length(); String newLine = replace(line, begin, end, "PF('" + widgetUsage.widgetVar + "')", false); if (testWrite) { System.out.println(newLine); } else { pw.println(newLine); } } else { if (!testWrite) { pw.println(line); } } } } catch (IOException ex) { throw new RuntimeException(ex); } } else { System.out.println("Skipped!"); } }); new TreeSet<>(unusedOrAmbiguous).forEach(widgetUsage -> { int startIndex = widgetUsage.columnNr; int endIndex = startIndex + widgetUsage.widgetVar.length(); String relativePath = widgetUsage.location.toAbsolutePath().toString() .substring(sourceDirectory.toString().length()); String previous = replace(widgetUsage.line, startIndex, endIndex, Ansi.ansi().bold().fg(Ansi.Color.RED).a(widgetUsage.widgetVar).reset().toString()); System.out.println("Skipped unused or ambiguous " + relativePath + " at line " + widgetUsage.lineNr + " and col " + widgetUsage.columnNr); System.out.println("\t" + previous); }); threadPool.shutdown(); }
From source file:emperior.Main.java
public static void main(String[] args) throws Exception { mainFrame = new MainFrame(); operatingSystem = System.getProperty("os.name"); CommandLineParser parser = new BasicParser(); Options options = new Options(); options.addOption("h", "help", false, "Print this usage information"); options.addOption("t", "test", true, "Name of the Bat-File which is executed for Compilation and Unit-Testing"); options.addOption("r", "run", true, "Name of the Bat-File which is executed for Compilation and running the project"); options.addOption("f", "folder", true, "Name of the Folder in which the exercises for the Experiment are stored"); CommandLine commandLine = parser.parse(options, args); // read from command line if (commandLine.getOptions().length > 0) { readCommandLine(commandLine, options); }// w ww . j a va 2 s . c o m // read from property file else { readPropertyFile(); } initLogging(); checkBatFile(); addLineToLogFile("[Start] Emperior"); if (resuming) Main.addLineToLogFile("[ResumeTask] Resume task: " + Main.tasktypes.get(Main.activeType) + "_" + Main.tasks.get(Main.activeTask)); else { Main.addLineToLogFile("[StartTask] Start new task: " + Main.tasktypes.get(Main.activeType) + "_" + Main.tasks.get(Main.activeTask)); startedWith = Main.tasktypes.get(Main.activeType) + "_" + Main.tasks.get(Main.activeTask); updateStartedWithTask(Main.tasktypes.get(Main.activeType) + "_" + Main.tasks.get(Main.activeTask)); } mainFrame.init(); mainFrame.setSize(800, 600); mainFrame.setVisible(true); mainFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { Main.addLineToLogFile("[PauseTask] Stop task: " + Main.tasktypes.get(Main.activeType) + "_" + Main.tasks.get(Main.activeTask)); addLineToLogFile("[Close] Emperior"); updateResumeTask(tasktypes.get(activeType) + "_" + tasks.get(activeTask)); System.exit(0); } }); mainFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); //makeContiniousCopys(); }
From source file:com.example.bigtable.simplecli.HBaseCLI.java
/** * The main method for the CLI. This method takes the command line * arguments and runs the appropriate commands. *//*from w w w. j a v a 2 s.co m*/ public static void main(String[] args) { // We use Apache commons-cli to check for a help option. Options options = new Options(); Option help = new Option("help", "print this message"); options.addOption(help); // create the parser CommandLineParser parser = new BasicParser(); CommandLine line = null; try { // parse the command line arguments line = parser.parse(options, args); } catch (ParseException exp) { // oops, something went wrong System.err.println(exp.getMessage()); usage(); System.exit(1); } // Create a list of commands that are supported. Each // command defines a run method and some methods for // printing help. // See the definition of each command below. HashMap<String, Command> commands = new HashMap<String, Command>(); commands.put("create", new CreateCommand("create")); commands.put("scan", new ScanCommand("scan")); commands.put("get", new GetCommand("get")); commands.put("put", new PutCommand("put")); commands.put("list", new ListCommand("list")); Command command = null; List<String> argsList = Arrays.asList(args); if (argsList.size() > 0) { command = commands.get(argsList.get(0)); } // Check for the help option and if it's there // display the appropriate help. if (line.hasOption("help")) { // If there is a command listed (e.g. create -help) // then show the help for that command if (command == null) { help(commands.values()); } else { help(command); } System.exit(0); } else if (command == null) { // No valid command was given so print the usage. usage(); System.exit(0); } try { Connection connection = ConnectionFactory.createConnection(); try { try { // Run the command with the arguments after the command name. command.run(connection, argsList.subList(1, argsList.size())); } catch (InvalidArgsException e) { System.out.println("ERROR: Invalid arguments"); usage(command); System.exit(0); } } finally { // Make sure the connection is closed even if // an exception occurs. connection.close(); } } catch (IOException e) { e.printStackTrace(); } }
From source file:com.eternitywall.ots.OtsCli.java
public static void main(String[] args) { // Create the Options Options options = new Options(); options.addOption("c", "calendar", true, "Create timestamp with the aid of a remote calendar. May be specified multiple times."); options.addOption("k", "key", true, "Signature key file of private remote calendars."); options.addOption("d", "digest", true, "Verify a (hex-encoded) digest rather than a file."); options.addOption("a", "algorithm", true, "Pass the hashing algorithm of the document to timestamp: SHA256(default), SHA1, RIPEMD160."); options.addOption("m", "", true, "Commitments are sent to remote calendars in the event of timeout the timestamp is considered done if at least M calendars replied."); options.addOption("s", "shrink", false, "Shrink upgraded timestamp."); options.addOption("V", "version", false, "Print " + title + " version."); options.addOption("v", "verbose", false, "Be more verbose.."); options.addOption("f", "file", true, "Specify target file explicitly (default: original file present in the same directory without .ots)"); options.addOption("h", "help", false, "print this help."); // Parse the args to retrieve options & command CommandLineParser parser = new BasicParser(); try {/* w ww.j av a 2 s . com*/ CommandLine line = parser.parse(options, args); // args are the arguments passed to the the application via the main method if (line.hasOption("c")) { String[] cals = line.getOptionValues("c"); calendarsUrl.addAll(Arrays.asList(cals)); } if (line.hasOption("m")) { m = Integer.valueOf(line.getOptionValue("m")); } if (line.hasOption("k")) { signatureFile = line.getOptionValue("k"); calendarsUrl.clear(); } if (line.hasOption("s")) { shrink = true; } if (line.hasOption("v")) { verbose = true; } if (line.hasOption("V")) { System.out.println("Version: " + title + " v." + version + '\n'); return; } if (line.hasOption("h")) { showHelp(); return; } if (line.hasOption("d")) { shasum = Utils.hexToBytes(line.getOptionValue("d")); } if (line.hasOption("f")) { verifyFile = line.getOptionValue("f"); } if (line.hasOption("a")) { algorithm = line.getOptionValue("a"); if (!Arrays.asList(algorithms).contains(algorithm.toUpperCase())) { System.out.println("Algorithm: " + algorithm + " not supported\n"); return; } } if (line.getArgList().isEmpty()) { showHelp(); return; } cmd = line.getArgList().get(0); files = line.getArgList().subList(1, line.getArgList().size()); } catch (Exception e) { System.out.println(title + ": invalid parameters "); return; } // Parse the command switch (cmd) { case "info": case "i": if (files.isEmpty()) { System.out.println("Show information on a timestamp given as argument.\n"); System.out.println(title + " info: bad options "); break; } info(files.get(0), verbose); break; case "stamp": case "s": if (!files.isEmpty()) { multistamp(files, calendarsUrl, m, signatureFile, algorithm); } else if (shasum != null) { Hash hash = new Hash(shasum, algorithm); stamp(hash, calendarsUrl, m, signatureFile); } else { System.out.println("Create timestamp with the aid of a remote calendar.\n"); System.out.println(title + ": bad options number "); } break; case "verify": case "v": if (!files.isEmpty()) { Hash hash = null; if (shasum != null) { hash = new Hash(shasum, algorithm); } if (verifyFile == null) { verifyFile = files.get(0).replace(".ots", ""); } verify(files.get(0), hash, verifyFile); } else { System.out.println("Verify the timestamp attestations given as argument.\n"); System.out.println(title + ": bad options number "); } break; case "upgrade": case "u": if (files.isEmpty()) { System.out.println("Upgrade remote calendar timestamps to be locally verifiable.\n"); System.out.println(title + ": bad options number "); break; } upgrade(files.get(0), shrink); break; default: System.out.println(title + ": bad option: " + cmd); } }
From source file:com.google.api.ads.adwords.awalerting.AwAlerting.java
/** * Main method./* ww w. ja v a2 s. co m*/ * * @param args the command line arguments */ public static void main(String args[]) { // Set up proxy. JaxWsProxySelector ps = new JaxWsProxySelector(ProxySelector.getDefault()); ProxySelector.setDefault(ps); Options options = createCommandLineOptions(); try { CommandLineParser parser = new BasicParser(); CommandLine cmdLine = parser.parse(options, args); // Print full help and quit if (cmdLine.hasOption("help")) { printHelpMessage(options); printSamplePropertiesFile(); System.exit(0); } if (!cmdLine.hasOption("file")) { LOGGER.error("Missing required option: 'file'"); System.exit(1); } processAlerts(cmdLine); } catch (ParseException e) { LOGGER.error("Error parsing the values for the command line options.", e); System.exit(1); } catch (AlertConfigLoadException e) { LOGGER.error("Error laoding alerts configuration.", e); System.exit(1); } catch (AlertProcessingException e) { LOGGER.error("Error processing alerts.", e); System.exit(1); } }
From source file:com.github.r351574nc3.amex.assignment1.App.java
public static void main(final String... args) { if (args.length < 1) { printUsage();//ww w.j a v a 2 s .c o m System.exit(0); } final Options options = new Options(); options.addOption(OptionBuilder.withArgName("output").hasArg(true).withDescription("Path for CSV output") .create("o")); options.addOption( OptionBuilder.withArgName("input").hasArg(true).withDescription("Path for CSV input").create("i")); final CommandLineParser parser = new BasicParser(); CommandLine cmd = null; try { cmd = parser.parse(options, args); } catch (Exception e) { System.out.println(e.getMessage()); printUsage(); System.exit(0); } if ((cmd.hasOption('o') && cmd.hasOption('i')) || !(cmd.hasOption('o') || cmd.hasOption('i')) || (cmd.hasOption('o') && cmd.getArgs().length < 1)) { printUsage(); System.exit(0); } if (cmd.hasOption('o') && cmd.getArgs().length > 0) { final String outputName = cmd.getOptionValue("o"); final int iterations = Integer.parseInt(cmd.getArgs()[cmd.getArgs().length - 1]); new App().run(new File(outputName), iterations); } else if (cmd.hasOption('i')) { final String inputName = cmd.getOptionValue("i"); new App().run(new File(inputName)); } System.exit(0); }
From source file:me.preilly.SimplePush.java
public static void main(String[] args) throws Exception { /* Parse command line arguments */ Options opt = new Options(); opt.addOption("d", false, "Debug"); opt.addOption("e", true, "Environment to run in"); opt.addOption("h", false, "Print help for this application"); BasicParser parser = new BasicParser(); CommandLine cl = parser.parse(opt, args); boolean err = false; if (cl.hasOption("e")) { environmentKey = cl.getOptionValue("e"); }//from w w w . j a va 2s .c o m if (err || cl.hasOption("h")) { HelpFormatter hf = new HelpFormatter(); hf.printHelp("java -jar SimplePush.jar -c cookie [-d -p -e [-f filename]]", opt); System.exit(0); } ConfigFactory factory = ConfigFactory.getInstance(); PropertiesConfiguration config = factory.getConfigProperties(environmentKey, propertiesFileName); Globals.getInstance(config); certName = config.getString(Const.CERT_NAME); certPass = config.getString(Const.CERT_PASSWORD); SimplePush obj = new SimplePush(); obj.pushMessage(); }
From source file:com.aguin.stock.recommender.UserOptions.java
public static void main(String[] args) { options = new Options(); Option optU = OptionBuilder.hasArg().withArgName("uid").isRequired(true).withType(String.class) .withDescription(/* www . j a v a 2 s .c om*/ "User ID : must be a valid email address which serves as the unique identity of the portfolio") .create("u"); Option optI = OptionBuilder.hasOptionalArgs().withArgName("item").withType(String.class).isRequired(false) .withDescription( "Stock(s) in your portfolio: Print all stocks selected by this option and preferences against them") .create("i"); Option optP = OptionBuilder.hasOptionalArgs().withArgName("pref").isRequired(false).withType(Long.class) .withDescription( "Preference(s) against stocks in portfolio : Print all preferences specified in option and all stocks listed against that preference. Multiple preferences may be specified to draw on the many-many relationship between stocks and preferences matrices") .create("p"); Option optIP = OptionBuilder.hasArg().withArgName("itempref").withValueSeparator(':').isRequired(false) .withDescription( "Enter stock and preferences over command line. Any new stock will be registered as a new entry along with preference. Each new preference for an already existing stock will overwrite the existing preference(so be careful!)") .create("ip"); Option optF = OptionBuilder.hasArg().withArgName("itempreffile").withType(String.class) .withDescription("File to read stock preference data from").isRequired(false).create("f"); Option optH = OptionBuilder.hasArg(false).withArgName("help").withType(String.class) .withDescription("Display usage").isRequired(false).create("h"); options.addOption(optU); options.addOption(optI); options.addOption(optP); options.addOption(optIP); options.addOption(optF); options.addOption(optH); parser = new BasicParser(); CommandLine line = null; try { line = parser.parse(options, args); } catch (MissingOptionException e) { System.out.println("Missing options"); printUsage(); } catch (ParseException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } if (line.hasOption("help")) { printUsage(); } UserArgumentEmailType uEmailId = new UserArgumentEmailType(line.getOptionValue("u")); String uEmailIdStr = uEmailId.toString(); if (MongoDBUserModel.registered(uEmailIdStr)) { System.out.format("Already registered user %s\n", uEmailIdStr); } else { System.out.format("+--Starting transaction for user %s --+\n", uEmailIdStr); } if (line.hasOption("f")) { System.out.println("Query::UpdateDB: itempreffile(s)\n"); String[] uItemPrefFiles = line.getOptionValues("f"); for (String it : uItemPrefFiles) { System.out.format("Updating db with user file %s\n", it); UserItemPrefFile uItemPrefFile = new UserItemPrefFile(uEmailIdStr, it); uItemPrefFile.writeToDB(); } } if (line.hasOption("i")) { System.out.println("Query::ReadDB: item(s)\n"); String[] uItems = line.getOptionValues("i"); for (String it : uItems) { System.out.format("Searching for item %s in db\n", it); UserItem uItem = new UserItem(uEmailIdStr, it); uItem.readFromDB(); } } if (line.hasOption("p")) { System.out.println("Query::ReadDB: preference(s)"); String[] uPrefs = line.getOptionValues("p"); for (String it : uPrefs) { System.out.format("Searching for preference %s in db\n", it); UserPreference uPref = new UserPreference(uEmailIdStr, it); uPref.readFromDB(); } } if (line.hasOption("ip")) { System.out.println("Query::UpdateDB: itempref(s)\n"); String[] uItemPrefs = line.getOptionValues("ip"); for (String it : uItemPrefs) { System.out.format("Updating item:preference pair %s\n", it); String[] pair = it.split(":"); System.out.format("%s:%s:%s", uEmailIdStr, pair[0], pair[1]); UserItemPreference uItemPref = new UserItemPreference(uEmailIdStr, pair[0], pair[1]); uItemPref.writeToDB(); } } System.out.format("+-- Ending transaction for user %s --+\n", uEmailIdStr); }
From source file:edu.ksu.cis.indus.xmlizer.JimpleXMLizerCLI.java
/** * The entry point to execute this xmlizer from command prompt. * //from w w w.j av a 2 s . c o m * @param s is the command-line arguments. * @throws RuntimeException when jimple xmlization fails. * @pre s != null */ public static void main(final String[] s) { final Scene _scene = Scene.v(); final Options _options = new Options(); Option _o = new Option("d", "dump directory", true, "The directory in which to write the xml files. " + "If unspecified, the xml output will be directed standard out."); _o.setArgs(1); _o.setArgName("path"); _o.setOptionalArg(false); _options.addOption(_o); _o = new Option("h", "help", false, "Display message."); _options.addOption(_o); _o = new Option("p", "soot-classpath", true, "Prepend this to soot class path."); _o.setArgs(1); _o.setArgName("classpath"); _o.setOptionalArg(false); _options.addOption(_o); final HelpFormatter _help = new HelpFormatter(); try { final CommandLine _cl = (new BasicParser()).parse(_options, s); final String[] _args = _cl.getArgs(); if (_cl.hasOption('h')) { final String _cmdLineSyn = "java " + JimpleXMLizerCLI.class.getName() + "<options> <class names>"; _help.printHelp(_cmdLineSyn.length(), _cmdLineSyn, "", _options, "", true); } else { if (_args.length > 0) { if (_cl.hasOption('p')) { _scene.setSootClassPath( _cl.getOptionValue('p') + File.pathSeparator + _scene.getSootClassPath()); } final NamedTag _tag = new NamedTag("JimpleXMLizer"); for (int _i = 0; _i < _args.length; _i++) { final SootClass _sc = _scene.loadClassAndSupport(_args[_i]); _sc.addTag(_tag); } final IProcessingFilter _filter = new TagBasedProcessingFilter(_tag.getName()); writeJimpleAsXML(new Environment(_scene), _cl.getOptionValue('d'), null, new UniqueJimpleIDGenerator(), _filter); } else { System.out.println("No classes were specified."); } } } catch (final ParseException _e) { LOGGER.error("Error while parsing command line.", _e); printUsage(_options); } catch (final Throwable _e) { LOGGER.error("Beyond our control. May day! May day!", _e); throw new RuntimeException(_e); } }
From source file:kieker.develop.rl.cli.CLICompilerMain.java
/** * Main method for the compiler, decoding parameter and execution * compilation./*from ww w . ja v a2s .c om*/ * * @param args * command line arguments */ public static void main(final String[] args) { String runtimeRoot = ""; String projectName = ""; String projectSourcePath = "src"; String projectDestinationPath = "src-gen"; String projectDirectoryName = null; String authorName = "Generic Kieker"; String version = "1.10"; boolean mavenFolderLayout = false; String[] selectedLanguageTypes = {}; int exitCode = 0; CLICompilerMain.declareOptions(); try { // parse the command line arguments commandLine = new BasicParser().parse(options, args); if (commandLine.hasOption(CMD_ROOT)) { runtimeRoot = commandLine.getOptionValue(CMD_ROOT); } if (commandLine.hasOption(CMD_PROJECT)) { projectName = commandLine.getOptionValue(CMD_PROJECT); } if (commandLine.hasOption(CMD_PROJECT_DIRECTORY)) { projectDirectoryName = commandLine.getOptionValue(CMD_PROJECT_DIRECTORY); } if (commandLine.hasOption(CMD_SOURCE)) { projectSourcePath = commandLine.getOptionValue(CMD_SOURCE); } if (commandLine.hasOption(CMD_DESTINATION)) { projectDestinationPath = commandLine.getOptionValue(CMD_DESTINATION); } mavenFolderLayout = commandLine.hasOption(CMD_MAVEN_FOLDER_LAYOUT); if (commandLine.hasOption(CMD_LANGUAGES)) { selectedLanguageTypes = commandLine.getOptionValues(CMD_LANGUAGES); } else { CLICompilerMain.usage("No target languages defined."); System.exit(-1); } if (commandLine.hasOption(CMD_AUTHOR)) { authorName = commandLine.getOptionValue(CMD_AUTHOR); } if (commandLine.hasOption(CMD_VERSION)) { version = commandLine.getOptionValue(CMD_VERSION); } parser = new IRLParser(runtimeRoot, projectName, projectDirectoryName, projectSourcePath, projectDestinationPath, mavenFolderLayout, selectedLanguageTypes, version, authorName); parser.compileAll(); } catch (final ParseException e) { CLICompilerMain.usage("Parsing failed. Reason: " + e.getMessage()); exitCode = 4; } System.exit(exitCode); }