For the latest stable version, please use Spring Shell 3.3.3! |
Legacy Annotation
Having a target method with argument is automatically registered with a matching argument name.
@ShellMethod
public String example(String arg1) {
return "Hello " + arg1;
}
@ShellOption
annotation can be used to define an option name if you
don’t want it to be same as argument name.
@ShellMethod
public String example(@ShellOption(value = { "--arg" }) String arg1) {
return "Hello " + arg1;
}
If option name is defined without prefix, either -
or --
, it is discovered
from ShellMethod#prefix.
@ShellMethod
public String example(@ShellOption(value = { "arg" }) String arg1) {
return "Hello " + arg1;
}