Esempio n. 1
0
 public static Arguments parseCommandLine(String[] args) {
   CommandLine commandLine =
       new CommandLine("[-p port][-d dir][-r root][-l logDir][-e days][-o][-a userpass]");
   Arguments arguments = null;
   if (commandLine.parse(args)) {
     arguments = new Arguments();
     if (commandLine.hasOption("p")) arguments.setPort(commandLine.getOptionArgument("p", "port"));
     if (commandLine.hasOption("d"))
       arguments.setRootPath(commandLine.getOptionArgument("d", "dir"));
     if (commandLine.hasOption("r"))
       arguments.setRootDirectory(commandLine.getOptionArgument("r", "root"));
     if (commandLine.hasOption("l"))
       arguments.setLogDirectory(commandLine.getOptionArgument("l", "logDir"));
     if (commandLine.hasOption("e"))
       arguments.setDaysTillVersionsExpire(commandLine.getOptionArgument("e", "days"));
     if (commandLine.hasOption("a"))
       arguments.setUserpass(commandLine.getOptionArgument("a", "userpass"));
     arguments.setOmitUpdates(commandLine.hasOption("o"));
   }
   return arguments;
 }