@Test public void testWithDashD() throws CLIException { CLI cli = new DefaultCLI().setName("test"); Option[] options = new Option[]{ new TypedOption<String>().setShortName("D").setLongName("systemProperty") .setMultiValued(true).setType(String.class), new TypedOption<Boolean>().setShortName("F").setLongName("flag") .setFlag(true) .setType(Boolean.class) }; cli.addOptions(Arrays.asList(options)); CommandLine evaluated = cli.parse(Arrays.asList("-Dx=y", "-F")); assertThat(evaluated.cli().getOptions()).hasSize(2); assertThat(evaluated.getRawValueForOption(evaluated.cli().getOption("systemProperty"))) .isEqualTo("x=y"); assertThat((boolean) evaluated.getOptionValue("flag")).isTrue(); }
/** * Gets the raw value of the given option. Raw values are the values as given in the user command line. * @param option the option * @return the value, <code>null</code> if none. */ public String getRawValueForOption(Option option) { String ret = delegate.getRawValueForOption(option); return ret; }
/** * Gets the raw value of the given option. Raw values are the values as given in the user command line. * @param option the option * @return the value, <code>null</code> if none. */ public String getRawValueForOption(Option option) { String ret = delegate.getRawValueForOption(option); return ret; }
@Test public void testWithDashD() throws CLIException { CLI cli = new DefaultCLI().setName("test"); Option[] options = new Option[]{ new TypedOption<String>().setShortName("D").setLongName("systemProperty") .setMultiValued(true).setType(String.class), new TypedOption<Boolean>().setShortName("F").setLongName("flag") .setFlag(true) .setType(Boolean.class) }; cli.addOptions(Arrays.asList(options)); CommandLine evaluated = cli.parse(Arrays.asList("-Dx=y", "-F")); assertThat(evaluated.cli().getOptions()).hasSize(2); assertThat(evaluated.getRawValueForOption(evaluated.cli().getOption("systemProperty"))) .isEqualTo("x=y"); assertThat((boolean) evaluated.getOptionValue("flag")).isTrue(); }
public static java.lang.String getRawValueForOption(io.vertx.core.cli.CommandLine j_receiver, java.util.Map<String, Object> option) { return j_receiver.getRawValueForOption(option != null ? new io.vertx.core.cli.Option(io.vertx.core.impl.ConversionHelper.toJsonObject(option)) : null); } public static boolean acceptMoreValues(io.vertx.core.cli.CommandLine j_receiver, java.util.Map<String, Object> option) {