use of org.kohsuke.args4j.CmdLineParser in project pinot by linkedin.
the class PerfBenchmarkRunner method main.
/**
* Main method for the class.
*
* @param args arguments for the perf benchmark runner.
* @throws Exception
*/
public static void main(String[] args) throws Exception {
PerfBenchmarkRunner perfBenchmarkRunner = new PerfBenchmarkRunner();
CmdLineParser parser = new CmdLineParser(perfBenchmarkRunner);
parser.parseArgument(args);
if (perfBenchmarkRunner._help) {
perfBenchmarkRunner.printUsage();
} else {
perfBenchmarkRunner.execute();
}
}
use of org.kohsuke.args4j.CmdLineParser in project buck by facebook.
the class StringSetOptionHandlerTest method testOptionSpecifiedWithoutElements.
@Test(expected = IllegalArgumentException.class)
public void testOptionSpecifiedWithoutElements() throws CmdLineException {
TestBean bean = new TestBean();
CmdLineParser parser = new CmdLineParser(bean);
parser.parseArgument("--option1", "a", "--option2", "c", "d", "--option1", "--option2", "f");
}
use of org.kohsuke.args4j.CmdLineParser in project buck by facebook.
the class StringSetOptionHandlerTest method testDefaultValues.
@Test
public void testDefaultValues() throws CmdLineException {
TestBean bean = new TestBean();
CmdLineParser parser = new CmdLineParser(bean);
parser.parseArgument("--option2", "a", "b");
assertEquals(ImmutableSet.of(), bean.getOption1());
assertEquals(ImmutableSet.of("a", "b"), bean.getOption2());
}
use of org.kohsuke.args4j.CmdLineParser in project buck by facebook.
the class StringSetOptionHandlerTest method testEmptyOption.
@Test(expected = IllegalArgumentException.class)
public void testEmptyOption() throws CmdLineException {
TestBean bean = new TestBean();
CmdLineParser parser = new CmdLineParser(bean);
parser.parseArgument("--option1", "--option2", "c", "d", "--option2", "f");
}
use of org.kohsuke.args4j.CmdLineParser 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());
}
Aggregations