This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Shell 3.4.0! |
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;
}