Search in sources :

Example 21 with CmdLineParser

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

the class DeleteOrcidByIdentifier method main.

public static void main(String[] args) {
    DeleteOrcidByIdentifier deleteOrcidByIdentifier = new DeleteOrcidByIdentifier();
    CmdLineParser parser = new CmdLineParser(deleteOrcidByIdentifier);
    try {
        parser.parseArgument(args);
        deleteOrcidByIdentifier.validateArgs(parser);
        deleteOrcidByIdentifier.execute();
    } catch (CmdLineException e) {
        System.err.println(e.getMessage());
        parser.printUsage(System.err);
    }
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) CmdLineException(org.kohsuke.args4j.CmdLineException)

Example 22 with CmdLineParser

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

the class CreateNewClientSecrets method main.

public static void main(String[] args) {
    CreateNewClientSecrets createNewClientSecrets = new CreateNewClientSecrets();
    CmdLineParser parser = new CmdLineParser(createNewClientSecrets);
    try {
        parser.parseArgument(args);
        createNewClientSecrets.validateArgs(parser);
        createNewClientSecrets.execute();
    } catch (CmdLineException e) {
        System.err.println(e.getMessage());
        parser.printUsage(System.err);
    } finally {
        System.exit(0);
    }
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) CmdLineException(org.kohsuke.args4j.CmdLineException)

Example 23 with CmdLineParser

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

the class DeleteWorkByIdentifier method main.

public static void main(String[] args) {
    DeleteWorkByIdentifier deleteWorkByIdentifier = new DeleteWorkByIdentifier();
    CmdLineParser parser = new CmdLineParser(deleteWorkByIdentifier);
    try {
        parser.parseArgument(args);
        deleteWorkByIdentifier.validateArgs(parser);
        deleteWorkByIdentifier.execute();
    } catch (CmdLineException e) {
        System.err.println(e.getMessage());
        parser.printUsage(System.err);
    }
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) CmdLineException(org.kohsuke.args4j.CmdLineException)

Example 24 with CmdLineParser

use of org.kohsuke.args4j.CmdLineParser in project gerrit by GerritCodeReview.

the class AsciiDoctor method invoke.

private void invoke(String... parameters) throws IOException {
    CmdLineParser parser = new CmdLineParser(this);
    try {
        parser.parseArgument(parameters);
        if (inputFiles.isEmpty()) {
            throw new CmdLineException(parser, "asciidoctor: FAILED: input file missing");
        }
    } catch (CmdLineException e) {
        System.err.println(e.getMessage());
        parser.printUsage(System.err);
        System.exit(1);
        return;
    }
    if (revnumberFile != null) {
        try (BufferedReader reader = new BufferedReader(new FileReader(revnumberFile))) {
            revnumber = reader.readLine();
        }
    }
    if (mktmp) {
        tmpdir = Files.createTempDirectory("asciidoctor-").toFile();
    }
    if (bazel) {
        renderFiles(inputFiles, null);
    } else {
        try (ZipOutputStream zip = new ZipOutputStream(Files.newOutputStream(Paths.get(zipFile)))) {
            renderFiles(inputFiles, zip);
            File[] cssFiles = tmpdir.listFiles(new FilenameFilter() {

                @Override
                public boolean accept(File dir, String name) {
                    return name.endsWith(".css");
                }
            });
            for (File css : cssFiles) {
                zipFile(css, css.getName(), zip);
            }
        }
    }
}
Also used : FilenameFilter(java.io.FilenameFilter) CmdLineParser(org.kohsuke.args4j.CmdLineParser) ZipOutputStream(java.util.zip.ZipOutputStream) BufferedReader(java.io.BufferedReader) FileReader(java.io.FileReader) File(java.io.File) CmdLineException(org.kohsuke.args4j.CmdLineException)

Example 25 with CmdLineParser

use of org.kohsuke.args4j.CmdLineParser in project asterixdb by apache.

the class AsterixClientDriver method main.

public static void main(String[] args) throws Exception {
    AsterixClientConfig acc = new AsterixClientConfig();
    CmdLineParser cmdParser = new CmdLineParser(acc);
    try {
        cmdParser.parseArgument(args);
    } catch (Exception e) {
        cmdParser.printUsage(System.err);
        throw e;
    }
    if (acc.getArguments().isEmpty()) {
        System.err.println("Please specify the file containing the query.");
        return;
    }
    if (acc.getArguments().size() > 1) {
        System.err.print("Too many arguments. ");
        System.err.println("Only the file contained the query needs to be specified.");
        return;
    }
    boolean exec = new Boolean(acc.execute);
    IHyracksClientConnection hcc = exec ? new HyracksConnection("localhost", acc.hyracksPort) : null;
    AsterixJavaClient q = compileQuery(hcc, acc.getArguments().get(0), new Boolean(acc.optimize), new Boolean(acc.onlyPhysical), exec || new Boolean(acc.hyracksJob));
    if (exec) {
        q.execute();
    }
}
Also used : AsterixClientConfig(org.apache.asterix.api.common.AsterixClientConfig) IHyracksClientConnection(org.apache.hyracks.api.client.IHyracksClientConnection) CmdLineParser(org.kohsuke.args4j.CmdLineParser) HyracksConnection(org.apache.hyracks.api.client.HyracksConnection) AsterixJavaClient(org.apache.asterix.api.java.AsterixJavaClient)

Aggregations

CmdLineParser (org.kohsuke.args4j.CmdLineParser)208 CmdLineException (org.kohsuke.args4j.CmdLineException)165 IOException (java.io.IOException)45 File (java.io.File)27 Test (org.junit.Test)14 KeeperException (org.apache.zookeeper.KeeperException)12 ArrayList (java.util.ArrayList)11 HyracksConnection (org.apache.hyracks.api.client.HyracksConnection)10 IHyracksClientConnection (org.apache.hyracks.api.client.IHyracksClientConnection)10 Directory (org.apache.lucene.store.Directory)10 FSDirectory (org.apache.lucene.store.FSDirectory)10 JobId (org.apache.hyracks.api.job.JobId)9 JobSpecification (org.apache.hyracks.api.job.JobSpecification)9 ClientException (com.ms.silverking.cloud.dht.client.ClientException)8 PutException (com.ms.silverking.cloud.dht.client.PutException)8 SKGridConfiguration (com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration)8 PrintStream (java.io.PrintStream)8 List (java.util.List)8 RetrievalException (com.ms.silverking.cloud.dht.client.RetrievalException)7 IndexArgs (io.anserini.index.IndexArgs)7