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.
- Backport #575
- Fixes #577
This commit is contained in:
Janne Valkealahti
2022-11-26 15:08:07 +00:00
parent 7e2c6c180a
commit e70ea6b555
4 changed files with 67 additions and 1 deletions

View File

@@ -25,6 +25,16 @@ include::{snippets}/OptionSnippets.java[tag=option-with-annotation]
----
====
If option name is defined without prefix, either `-` or `--`, it is discovered
from _ShellMethod#prefix_.
====
[source, java, indent=0]
----
include::{snippets}/OptionSnippets.java[tag=option-with-annotation-without-prefix]
----
====
Programmatic way with `CommandRegistration` is to use method adding a long name.
====