Register option without prefix

- While option should be defined i.e. using "--arg", discover
  prefix from ShellMethod#prefix and use that if just "arg"
  is defined.
- Fixes #575
This commit is contained in:
Janne Valkealahti
2022-11-26 15:08:07 +00:00
parent a900fa4977
commit 452145264a
4 changed files with 67 additions and 1 deletions

View File

@@ -119,6 +119,14 @@ public class StandardMethodTargetRegistrar implements MethodTargetRegistrar, App
else if (o.length() == stripped.length() + 1 && stripped.length() == 1) {
shortNames.add(stripped.charAt(0));
}
else if (o.length() == stripped.length()) {
if ("--".equals(shellMapping.prefix())) {
longNames.add(stripped);
}
else if ("-".equals(shellMapping.prefix()) && stripped.length() == 1) {
shortNames.add(stripped.charAt(0));
}
}
});
}
else {