Fix documentation
- Optional Parameters and Default Values. Type error in greet method signature who cause compile error - Customizing the Named Parameter Key(s). help method is already registered in spring shell by default and cannot be reused
This commit is contained in:
@@ -235,11 +235,12 @@ For such a setup, the possible parameter keys will be `-a`, `-b` and `--third`.
|
||||
[TIP]
|
||||
====
|
||||
It is possible to specify several keys for a single parameter. If so, these will be mutually exclusive ways
|
||||
to specify the same parameter (so only one of them can be used). Here is an example:
|
||||
to specify the same parameter (so only one of them can be used). As an example, here is the signature of the
|
||||
built-in xref:help-command[`help`] command:
|
||||
[source, java]
|
||||
----
|
||||
@ShellMethod("Describe a command.")
|
||||
public String help(@ShellOption({"-C", "--command"} String command) {
|
||||
public String help(@ShellOption({"-C", "--command"}) String command) {
|
||||
...
|
||||
}
|
||||
----
|
||||
@@ -252,7 +253,7 @@ those parameters:
|
||||
[source, java]
|
||||
----
|
||||
@ShellMethod("Say hello.")
|
||||
public String greet(@ShellOption(defaultValue="World"} String who) {
|
||||
public String greet(@ShellOption(defaultValue="World") String who) {
|
||||
return "Hello " + who;
|
||||
}
|
||||
----
|
||||
@@ -588,8 +589,6 @@ wildcard that matches all command names. It's thus easy to turn all commands of
|
||||
with a single availability method.
|
||||
====
|
||||
|
||||
|
||||
|
||||
[TIP]
|
||||
====
|
||||
Spring Shell does not impose much constraints on how to write commands and how to organize classes.
|
||||
|
||||
Reference in New Issue
Block a user