예제 #1
0
 public static <T> List<T> createFromList(String raw, TypedOption<T> option) {
   if (raw == null) {
     return Collections.emptyList();
   }
   final String[] segments = raw.split(option.getListSeparator());
   return Arrays.stream(segments).map(s -> create(s.trim(), option)).collect(Collectors.toList());
 }
예제 #2
0
  @Test
  public void testInjectionOfString() throws CLIException {
    HelloClI command = new HelloClI();
    CLI cli = CLIConfigurator.define(HelloClI.class);
    CommandLine evaluatedCLI = cli.parse(Arrays.asList("--name", "vert.x"));
    CLIConfigurator.inject(evaluatedCLI, command);

    assertThat(command.run()).isEqualToIgnoringCase("Hello vert.x");
    assertThat(command.name).isEqualToIgnoringCase("vert.x");
  }
예제 #3
0
 private CommandLine parse(CLI cli, String... args) throws CLIException {
   return cli.parse(Arrays.asList(args));
 }