}
public static void main(String[] args) throws Exception {
DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
ArgumentBuilder abuilder = new ArgumentBuilder();
GroupBuilder gbuilder = new GroupBuilder();
Option wikipediaFileOpt = obuilder.withLongName("wikiFile").withRequired(true).withArgument(
abuilder.withName("wikiFile").withMinimum(1).withMaximum(1).create()).
withDescription("The path to the wikipedia dump file. Maybe a directory containing wikipedia dump files." +
" If a directory is specified, only .xml files are used.").withShortName("w").create();
Option numDocsOpt = obuilder.withLongName("numDocs").withRequired(false).withArgument(
abuilder.withName("numDocs").withMinimum(1).withMaximum(1).create()).
withDescription("The number of docs to index").withShortName("n").create();
Option solrURLOpt = obuilder.withLongName("solrURL").withRequired(false).withArgument(
abuilder.withName("solrURL").withMinimum(1).withMaximum(1).create()).
withDescription("The URL where Solr lives").withShortName("s").create();
Option solrBatchOpt = obuilder.withLongName("batch").withRequired(false).withArgument(
abuilder.withName("batch").withMinimum(1).withMaximum(1).create()).
withDescription("The number of docs to include in each indexing batch").withShortName("b").create();
Group group = gbuilder.withName("Options").withOption(wikipediaFileOpt).withOption(numDocsOpt).withOption(solrURLOpt).withOption(solrBatchOpt).create();
Parser parser = new Parser();
parser.setGroup(group);
CommandLine cmdLine = parser.parse(args);