Search in sources :

Example 61 with CmdLineException

use of org.kohsuke.args4j.CmdLineException in project ORCID-Source by ORCID.

the class RemoveOrphanClients method main.

public static void main(String[] args) throws IOException {
    RemoveOrphanClients resaveProfiles = new RemoveOrphanClients();
    CmdLineParser parser = new CmdLineParser(resaveProfiles);
    try {
        parser.parseArgument(args);
        resaveProfiles.init();
        resaveProfiles.execute();
    } catch (CmdLineException e) {
        System.err.println(e.getMessage());
        parser.printUsage(System.err);
        System.exit(1);
    } catch (Throwable t) {
        System.err.println(t);
        System.exit(2);
    }
    System.exit(0);
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) CmdLineException(org.kohsuke.args4j.CmdLineException)

Example 62 with CmdLineException

use of org.kohsuke.args4j.CmdLineException 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 63 with CmdLineException

use of org.kohsuke.args4j.CmdLineException 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 64 with CmdLineException

use of org.kohsuke.args4j.CmdLineException 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 65 with CmdLineException

use of org.kohsuke.args4j.CmdLineException 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

CmdLineException (org.kohsuke.args4j.CmdLineException)105 CmdLineParser (org.kohsuke.args4j.CmdLineParser)80 IOException (java.io.IOException)16 File (java.io.File)14 ArrayList (java.util.ArrayList)11 PrintStream (java.io.PrintStream)7 StringWriter (java.io.StringWriter)6 List (java.util.List)5 FileOutputStream (java.io.FileOutputStream)4 Path (java.nio.file.Path)4 CmdLineParser (com.google.gerrit.util.cli.CmdLineParser)3 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 Project (com.google.gerrit.reviewdb.client.Project)2 OrmException (com.google.gwtorm.server.OrmException)2 Hudson (hudson.model.Hudson)2