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);
}
}
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);
}
}
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();
}
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());
}
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;
}
}
Aggregations