use of joptsimple.OptionParser in project jackrabbit-oak by apache.
the class OptionsTest method help.
@Test
public void help() throws Exception {
OptionParser parser = new OptionParser();
Options opts = new Options().withDisableSystemExit();
opts.parseAndConfigure(parser, new String[] { "-h" });
assertTrue(opts.getCommonOpts().isHelpRequested());
}
use of joptsimple.OptionParser in project jackrabbit-oak by apache.
the class OptionParserFactory method create.
public static OptionParser create() {
OptionParser op = new OptionParser();
addUsageOptions(op);
addBlobOptions(op);
addRdbOptions(op);
addPathsOptions(op);
addVersioningOptions(op);
addMiscOptions(op);
return op;
}
use of joptsimple.OptionParser in project samza by apache.
the class YarnJobValidationTool method main.
public static void main(String[] args) throws Exception {
CommandLine cmdline = new CommandLine();
OptionParser parser = cmdline.parser();
OptionSpec<String> validatorOpt = parser.accepts("metrics-validator", "The metrics validator class.").withOptionalArg().ofType(String.class).describedAs("com.foo.bar.ClassName");
OptionSet options = cmdline.parser().parse(args);
Config config = cmdline.loadConfig(options);
MetricsValidator validator = null;
if (options.has(validatorOpt)) {
String validatorClass = options.valueOf(validatorOpt);
validator = ClassLoaderHelper.<MetricsValidator>fromClassName(validatorClass);
}
YarnConfiguration hadoopConfig = new YarnConfiguration();
hadoopConfig.set("fs.http.impl", HttpFileSystem.class.getName());
hadoopConfig.set("fs.https.impl", HttpFileSystem.class.getName());
ClientHelper clientHelper = new ClientHelper(hadoopConfig);
new YarnJobValidationTool(new JobConfig(config), clientHelper.yarnClient(), validator).run();
}
use of joptsimple.OptionParser in project spring-boot by spring-projects.
the class OptionHandler method getParser.
public OptionParser getParser() {
if (this.parser == null) {
this.parser = new OptionParser();
options();
}
return this.parser;
}
use of joptsimple.OptionParser in project spring-framework by spring-projects.
the class JOptCommandLinePropertySourceTests method withCustomNonOptionArgsNameAndNoNonOptionArgsPresent.
@Test
public void withCustomNonOptionArgsNameAndNoNonOptionArgsPresent() {
OptionParser parser = new OptionParser();
parser.accepts("o1").withRequiredArg();
parser.accepts("o2");
OptionSet optionSet = parser.parse("--o1=v1", "noa1", "--o2", "noa2");
CommandLinePropertySource<?> ps = new JOptCommandLinePropertySource(optionSet);
ps.setNonOptionArgsPropertyName("NOA");
assertThat(ps.containsProperty("nonOptionArgs"), is(false));
assertThat(ps.containsProperty("NOA"), is(true));
assertThat(ps.containsProperty("o1"), is(true));
assertThat(ps.containsProperty("o2"), is(true));
String nonOptionArgs = ps.getProperty("NOA");
assertThat(nonOptionArgs, equalTo("noa1,noa2"));
}
Aggregations