Support explicit arity min max with @Option

- @Option now has arityMin/arityMax which if defined,
  non-negative, are used instead of arity.
- Fixes #731
This commit is contained in:
Janne Valkealahti
2023-05-01 08:36:41 +01:00
parent c36aa41878
commit 9d27466c6a
6 changed files with 225 additions and 40 deletions

View File

@@ -73,7 +73,7 @@ public class ArityCommands {
@Command(command = "arity-string-array")
public String testArityStringArrayAnnotation(
@Option(longNames = "arg1", defaultValue = "true", arity = OptionArity.ZERO_OR_MORE)
@Option(longNames = "arg1", defaultValue = "true", arityMax = 3)
String[] arg1
) {
return "Hello " + Arrays.asList(arg1);