Search in sources :

Example 71 with CmdLineParser

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);
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) CmdLineException(org.kohsuke.args4j.CmdLineException)

Example 72 with CmdLineParser

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);
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) OutputStreamWriter(java.io.OutputStreamWriter)

Example 73 with CmdLineParser

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();
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) CmdLineException(org.kohsuke.args4j.CmdLineException)

Example 74 with CmdLineParser

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));
    }
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) Sentence(edu.stanford.nlp.simple.Sentence) CmdLineException(org.kohsuke.args4j.CmdLineException)

Example 75 with CmdLineParser

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();
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) CmdLineException(org.kohsuke.args4j.CmdLineException)

Aggregations

CmdLineParser (org.kohsuke.args4j.CmdLineParser)119 CmdLineException (org.kohsuke.args4j.CmdLineException)80 File (java.io.File)16 Test (org.junit.Test)14 IOException (java.io.IOException)11 HyracksConnection (org.apache.hyracks.api.client.HyracksConnection)10 IHyracksClientConnection (org.apache.hyracks.api.client.IHyracksClientConnection)10 ArrayList (java.util.ArrayList)9 JobId (org.apache.hyracks.api.job.JobId)9 JobSpecification (org.apache.hyracks.api.job.JobSpecification)9 PrintStream (java.io.PrintStream)6 FileOutputStream (java.io.FileOutputStream)4 List (java.util.List)4 FeatureExtractors (io.anserini.ltr.feature.FeatureExtractors)3 Qrels (io.anserini.util.Qrels)3 Directory (org.apache.lucene.store.Directory)3 FSDirectory (org.apache.lucene.store.FSDirectory)3 ConsoleReporter (com.codahale.metrics.ConsoleReporter)2 MetricRegistry (com.codahale.metrics.MetricRegistry)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2