Rework command parser

- Previously CommandParser contained parser which was
  scannerless type of brute force parsing of command
  line args.
- Contract in that old parser wasn't super clear what
  is its role with caller as it was given options
  and registration was parsed in a Shell class.
- Add completely new parser package which has better
  model and which will be much easier to modify for
  future needs.
- Change some interfaces around parsing so that we do
  as much in this new parsing model instead of pre-parsing
  something in a Shell class.
- We also try to move away from using exceptions as
  a message delivery which had its own problems. Instead
  introducing parser messages which gives better info
  when errors are detected.
- Add ParserConfig class which allows to expose settings
  to change some parser features. Later this will be
  exposed to user so that some features can be turned on/off
  for an actual shell needs.
- Fixes #646
This commit is contained in:
Janne Valkealahti
2023-02-08 15:47:08 +00:00
parent e8d5d70792
commit 75b8a0c90e
40 changed files with 3826 additions and 1256 deletions

View File

@@ -162,9 +162,6 @@ public class StandardMethodTargetRegistrar implements MethodTargetRegistrar {
else if (ClassUtils.isAssignable(Boolean.class, parameterType)) {
optionSpec.arity(OptionArity.ZERO);
}
else {
optionSpec.arity(OptionArity.EXACTLY_ONE);
}
}
if (!ObjectUtils.nullSafeEquals(so.defaultValue(), ShellOption.NONE)
&& !ObjectUtils.nullSafeEquals(so.defaultValue(), ShellOption.NULL)) {