use of org.kohsuke.args4j.CmdLineParser in project ORCID-Source by ORCID.
the class ProfileEventManager method main.
public static void main(String... args) {
context = new ClassPathXmlApplicationContext("orcid-core-context.xml");
ProfileEventManager pem = (ProfileEventManager) context.getBean("profileEventManager");
CmdLineParser parser = new CmdLineParser(pem);
if (args == null) {
parser.printUsage(System.err);
}
try {
parser.parseArgument(args);
pem.execute(pem);
} catch (CmdLineException e) {
System.err.println(e.getMessage());
parser.printUsage(System.err);
}
System.exit(0);
}
use of org.kohsuke.args4j.CmdLineParser in project opennms by OpenNMS.
the class Command method printUsage.
/**
* Prints the usage of the command.
*/
public void printUsage() {
CmdLineParser parser = new CmdLineParser(this);
LOG.info(getDescription());
LOG.info("");
parser.printUsage(new OutputStreamWriter(LOG.getOutputStream()), null, OptionHandlerFilter.ALL);
}
use of org.kohsuke.args4j.CmdLineParser in project Anserini by castorini.
the class IndexCollection method main.
public static void main(String[] args) throws Exception {
IndexCollection.Args indexCollectionArgs = new IndexCollection.Args();
CmdLineParser parser = new CmdLineParser(indexCollectionArgs, ParserProperties.defaults().withUsageWidth(90));
try {
parser.parseArgument(args);
} catch (CmdLineException e) {
System.err.println(e.getMessage());
parser.printUsage(System.err);
System.err.println("Example: " + IndexCollection.class.getSimpleName() + parser.printExample(OptionHandlerFilter.REQUIRED));
return;
}
new IndexCollection(indexCollectionArgs).run();
}
use of org.kohsuke.args4j.CmdLineParser in project Anserini by castorini.
the class IndexUtils method main.
public static void main(String[] argv) throws Exception {
Args args = new Args();
CmdLineParser parser = new CmdLineParser(args, ParserProperties.defaults().withUsageWidth(90));
try {
parser.parseArgument(argv);
} catch (CmdLineException e) {
System.err.println(e.getMessage());
parser.printUsage(System.err);
return;
}
final IndexUtils util = new IndexUtils(args.index);
if (args.stats) {
util.printIndexStats();
}
if (args.term != null) {
util.printTermCounts(args.term);
}
if (args.docvectorDocid != null) {
util.printDocumentVector(args.docvectorDocid);
}
if (args.rawDoc != null) {
System.out.println(util.getRawDocument(args.rawDoc));
}
if (args.transformedDoc != null) {
System.out.println(util.getTransformedDocument(args.transformedDoc));
}
if (args.sentDoc != null) {
for (Sentence sent : util.getSentDocument(args.sentDoc)) {
System.out.println(sent);
}
}
if (args.lookupDocid != null) {
System.out.println(util.convertDocidToLuceneDocid(args.lookupDocid));
}
if (args.lookupLuceneDocid > 0) {
System.out.println(util.convertLuceneDocidToDocid(args.lookupLuceneDocid));
}
}
use of org.kohsuke.args4j.CmdLineParser in project Anserini by castorini.
the class IndexObjectTriples method main.
public static void main(String[] args) throws Exception {
Args indexRDFCollectionArgs = new Args();
CmdLineParser parser = new CmdLineParser(indexRDFCollectionArgs, ParserProperties.defaults().withUsageWidth(90));
try {
parser.parseArgument(args);
} catch (CmdLineException e) {
System.err.println(e.getMessage());
parser.printUsage(System.err);
System.err.println("Example command: " + IndexObjectTriples.class.getSimpleName() + parser.printExample(OptionHandlerFilter.REQUIRED));
return;
}
new IndexObjectTriples(indexRDFCollectionArgs).run();
}
Aggregations