(String[] args)
| 49 | } |
| 50 | |
| 51 | private CommandLine parseCommandLine(String[] args) { |
| 52 | // create the command line parser |
| 53 | CommandLineParser parser = new DefaultParser(); |
| 54 | |
| 55 | // create the Options |
| 56 | Options options = new Options(); |
| 57 | for (String[] opt : opts) { |
| 58 | Option option = Option.builder(opt[0]).longOpt(opt[1]).hasArg("true".equalsIgnoreCase(opt[2])).desc(opt[4]).get(); |
| 59 | option.setRequired("true".equalsIgnoreCase(opt[3])); |
| 60 | options.addOption(option); |
| 61 | } |
| 62 | |
| 63 | // parse the command line arguments |
| 64 | CommandLine line = null; |
| 65 | try { |
| 66 | line = parser.parse(options, args); |
| 67 | } catch (ParseException e) { |
| 68 | System.out.println("Command line parsing error: " + e.getMessage()); |
| 69 | usage(options); |
| 70 | System.exit(-1); |
| 71 | } |
| 72 | return line; |
| 73 | } |
| 74 | |
| 75 | private void process(String[] args) throws Exception { |
| 76 | CommandLine options = parseCommandLine(args); |
no test coverage detected