OptionValues supports multiple resolvers

- Change ref field in OptionValues to providers
  takin an array.
- Relates #637
This commit is contained in:
Janne Valkealahti
2023-03-05 16:38:01 +00:00
parent d4506d2583
commit eaa3e5caf9
4 changed files with 62 additions and 11 deletions

View File

@@ -62,8 +62,8 @@ public class InteractiveCompletionCommands {
@Command(command = "interactive-completion-1")
public String testRequiredValueAnnotation(
@Option(longNames = "arg1", required = true) @OptionValues(ref = "test1CompletionProvider") String arg1,
@Option(longNames = "arg2", required = true) @OptionValues(ref = "test2CompletionProvider") String arg2
@Option(longNames = "arg1", required = true) @OptionValues(provider = "test1CompletionProvider") String arg1,
@Option(longNames = "arg2", required = true) @OptionValues(provider = "test2CompletionProvider") String arg2
) {
return "Hello " + arg1;
}
@@ -79,8 +79,8 @@ public class InteractiveCompletionCommands {
@Bean
CompletionProvider test2CompletionProvider() {
return ctx -> {
Test1ValuesProvider test1ValuesProvider = new Test1ValuesProvider();
return test1ValuesProvider.complete(ctx);
Test2ValuesProvider test2ValuesProvider = new Test2ValuesProvider();
return test2ValuesProvider.complete(ctx);
};
}
}