Fix method argument without ShellOption

- For annotated methods with arguments, change default arity
  to zero with booleans and one everything else regardless
  if @ShellOption is defined or not.
- OptionArity.ZERO_OR_ONE had wrong upperbound value, change
  from MAX to 1.
- These modification should take us a bit closer to old
  shell functionality and what ShellOption documents for arity.
- For old functionality I'm referring to method
  `add(int a, int b)` and/or having @ShellOption and/or without
  arity setting.
- Fixes #446
This commit is contained in:
Janne Valkealahti
2022-07-14 20:21:52 +01:00
parent c9cea37cf0
commit 5ba8e185bc
2 changed files with 25 additions and 3 deletions

View File

@@ -608,7 +608,7 @@ public interface CommandRegistration {
break;
case ZERO_OR_ONE:
this.arityMin = 0;
this.arityMax = Integer.MAX_VALUE;
this.arityMax = 1;
break;
case EXACTLY_ONE:
this.arityMin = 1;