// Move to Arguments class. public static Arguments parseCommandLine(String[] args) { CommandLine commandLine = new CommandLine( "[-v][-p port][-d dir][-r root][-l logDir][-f config][-e days][-o][-i][-a userpass][-c command][-b output]"); Arguments arguments = null; if (commandLine.parse(args)) { arguments = new Arguments(); if (commandLine.hasOption("v")) arguments.setVerboseLogging(true); 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")); if (commandLine.hasOption("c")) arguments.setCommand(commandLine.getOptionArgument("c", "command")); if (commandLine.hasOption("b")) arguments.setOutput(commandLine.getOptionArgument("b", "output")); if (commandLine.hasOption("f")) arguments.setConfigFile(commandLine.getOptionArgument("f", "config")); arguments.setOmitUpdates(commandLine.hasOption("o")); arguments.setInstallOnly(commandLine.hasOption("i")); } return arguments; }