Fix use of default values

- Change parsing to extract and use option default value
  and also hook it with @ShellOption.
- Fixes #409
This commit is contained in:
Janne Valkealahti
2022-05-11 07:16:00 +01:00
parent 6738c92117
commit 75ff6e976f
4 changed files with 75 additions and 0 deletions

View File

@@ -131,6 +131,10 @@ public class StandardMethodTargetRegistrar implements MethodTargetRegistrar, App
if (so.arity() > -1) {
optionSpec.arity(0, so.arity());
}
if (!ObjectUtils.nullSafeEquals(so.defaultValue(), ShellOption.NONE)
&& !ObjectUtils.nullSafeEquals(so.defaultValue(), ShellOption.NULL)) {
optionSpec.defaultValue(so.defaultValue());
}
}
}
else {