Search in sources :

Example 1 with CmdLineException

use of org.kohsuke.args4j.CmdLineException in project pinot by linkedin.

the class PinotAdministrator method execute.

public void execute(String[] args) throws Exception {
    try {
        CmdLineParser parser = new CmdLineParser(this);
        parser.parseArgument(args);
        if ((_subCommand == null) || _help) {
            printUsage();
        } else if (_subCommand.getHelp()) {
            _subCommand.printUsage();
            _status = true;
        } else {
            _status = _subCommand.execute();
        }
    } catch (CmdLineException e) {
        LOGGER.error("Error: {}", e.getMessage());
    } catch (Exception e) {
        LOGGER.error("Exception caught: ", e);
    }
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) CmdLineException(org.kohsuke.args4j.CmdLineException) CmdLineException(org.kohsuke.args4j.CmdLineException)

Example 2 with CmdLineException

use of org.kohsuke.args4j.CmdLineException in project pinot by linkedin.

the class PinotToolLauncher method execute.

public void execute(String[] args) throws Exception {
    try {
        CmdLineParser parser = new CmdLineParser(this);
        parser.parseArgument(args);
        if ((_subCommand == null) || _help) {
            printUsage();
        } else if (_subCommand.getHelp()) {
            _subCommand.printUsage();
        } else {
            _subCommand.execute();
        }
    } catch (CmdLineException e) {
        LOGGER.error("Error: {}", e.getMessage());
    } catch (Exception e) {
        LOGGER.error("Exception caught: ", e);
    }
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) CmdLineException(org.kohsuke.args4j.CmdLineException) CmdLineException(org.kohsuke.args4j.CmdLineException)

Example 3 with CmdLineException

use of org.kohsuke.args4j.CmdLineException in project pinot by linkedin.

the class MoveReplicaGroup method main.

public static void main(String[] args) throws Exception {
    MoveReplicaGroup mrg = new MoveReplicaGroup();
    CmdLineParser parser = new CmdLineParser(mrg);
    try {
        parser.parseArgument(args);
    } catch (CmdLineException e) {
        LOGGER.error("Failed to parse arguments: {}", e);
        parser.printUsage(System.err);
        System.exit(1);
    }
    mrg.execute();
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) CmdLineException(org.kohsuke.args4j.CmdLineException)

Example 4 with CmdLineException

use of org.kohsuke.args4j.CmdLineException in project buck by facebook.

the class TargetDeviceCommandLineOptionsTest method serialFlagOverridesEnvironment.

@Test
public void serialFlagOverridesEnvironment() {
    TargetDeviceCommandLineOptions options = new TargetDeviceCommandLineOptions("1234");
    TargetDevice device = options.getTargetDeviceOptional().get();
    assertEquals("1234", device.getIdentifier().get());
    try {
        new CmdLineParser(options).parseArgument("-s", "5678");
    } catch (CmdLineException e) {
        fail("Unable to parse arguments");
    }
    device = options.getTargetDeviceOptional().get();
    assertEquals("5678", device.getIdentifier().get());
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) CmdLineException(org.kohsuke.args4j.CmdLineException) TargetDevice(com.facebook.buck.step.TargetDevice) Test(org.junit.Test)

Example 5 with CmdLineException

use of org.kohsuke.args4j.CmdLineException in project buck by facebook.

the class Main method run.

private static int run(String... args) {
    Args argsObject = new Args();
    CmdLineParser parser = new CmdLineParser(argsObject);
    try {
        parser.parseArgument(args);
    } catch (CmdLineException e) {
        e.printStackTrace();
        return 1;
    }
    try {
        return argsObject.run();
    } catch (EdenError | IOException | TException e) {
        e.printStackTrace();
        return 1;
    }
}
Also used : TException(com.facebook.thrift.TException) EdenError(com.facebook.eden.thrift.EdenError) CmdLineParser(org.kohsuke.args4j.CmdLineParser) IOException(java.io.IOException) CmdLineException(org.kohsuke.args4j.CmdLineException)

Aggregations

CmdLineException (org.kohsuke.args4j.CmdLineException)193 CmdLineParser (org.kohsuke.args4j.CmdLineParser)157 IOException (java.io.IOException)54 File (java.io.File)30 ArrayList (java.util.ArrayList)16 KeeperException (org.apache.zookeeper.KeeperException)12 StringWriter (java.io.StringWriter)10 List (java.util.List)10 Directory (org.apache.lucene.store.Directory)10 FSDirectory (org.apache.lucene.store.FSDirectory)10 PrintStream (java.io.PrintStream)9 SKGridConfiguration (com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration)8 Path (java.nio.file.Path)8 Map (java.util.Map)8 CmdLineParser (com.google.gerrit.util.cli.CmdLineParser)7 IndexArgs (io.anserini.index.IndexArgs)7 FileOutputStream (java.io.FileOutputStream)7 IndexReader (org.apache.lucene.index.IndexReader)7 ClientException (com.ms.silverking.cloud.dht.client.ClientException)6 PutException (com.ms.silverking.cloud.dht.client.PutException)6