Console console = new Console();
// Parse command line options
Options options = new Options();
Option helpOption = new Option("h", "help", false, "print this help");
Option versionOption = new Option("v", "version", false, "print version information");
Option serverURLOption = new Option("s", "serverURL", true,
"URL of Sesame server to connect to, e.g. http://localhost/openrdf-sesame/");
Option dirOption = new Option("d", "dataDir", true, "Sesame data dir to 'connect' to");
options.addOption(helpOption);
options.addOption(versionOption);
OptionGroup connectGroup = new OptionGroup();
connectGroup.addOption(serverURLOption);
connectGroup.addOption(dirOption);
options.addOptionGroup(connectGroup);
CommandLineParser argsParser = new PosixParser();
try {
CommandLine commandLine = argsParser.parse(options, args);
if (commandLine.hasOption(helpOption.getOpt())) {
printUsage(options);
System.exit(0);
}
if (commandLine.hasOption(versionOption.getOpt())) {
System.out.println(VERSION);
System.exit(0);
}
String dir = commandLine.getOptionValue(dirOption.getOpt());
String serverURL = commandLine.getOptionValue(serverURLOption.getOpt());
String[] otherArgs = commandLine.getArgs();
if (otherArgs.length > 1) {
printUsage(options);