Replace parser string joining with list

- Issue in #622 is that its command type is `String` and internally
  some incoming arguments(it's List) were converted to String by
  joining with space. This caused one case with help command to get
  conversion via spring's ConversionService(CollectionToStringConverter)
  which joins by commas. That was we saw in failed example.
- Remove needed joins in CommandParser and let it just pass List which
  then works better with ConversionService.
- This then needs a `command` option type change from String to String[]
  which it really is as you should be able to give whole command as
  an argument.
- Fixes #622
This commit is contained in:
Janne Valkealahti
2023-01-16 17:47:21 +00:00
parent a04091c08f
commit 6e1ca089d7
4 changed files with 29 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2022 the original author or authors.
* Copyright 2022-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -121,7 +121,7 @@ public class HelpTests {
.and()
.build();
commandCatalog.register(registration);
String help = this.help.help("first-command").toString();
String help = this.help.help(new String[] { "first-command" }).toString();
help = removeNewLines(help);
assertThat(help).isEqualTo(sample());
}
@@ -146,7 +146,7 @@ public class HelpTests {
@Test
public void testUnknownCommand() throws Exception {
assertThatThrownBy(() -> {
this.help.help("some unknown command");
this.help.help(new String[] { "some", "unknown", "command" });
}).isInstanceOf(IllegalArgumentException.class);
}