@@ -103,28 +103,27 @@ better with shell apps.
103103== Your First Command
104104
105105Now we can add our first command. To do so, create a new class (named whatever you want) and
106- annotate it with `@ShellComponent ` which is a variation of `@Component` that is used to restrict
106+ annotate it with `@Command ` which is a variation of `@Component` that is used to restrict
107107the set of classes that are scanned for candidate commands.
108108
109109Then we can create a `helloWorld` method that takes `String` as an argument and
110- returns it with "Hello world". Add `@ShellMethod ` and optionally change command name
111- using `key ` parameter. You can use `@ShellOption ` to define argument default value
110+ returns it with "Hello world". Add `@Command ` and optionally change command name
111+ using `command ` parameter. You can use `@Option ` to define argument default value
112112if it's not given when running a command.
113113
114114[source, java]
115115----
116116package com.example.demo;
117117
118- import org.springframework.shell.standard.ShellComponent;
119- import org.springframework.shell.standard.ShellMethod;
120- import org.springframework.shell.standard.ShellOption;
118+ import org.springframework.shell.command.annotation.Command;
119+ import org.springframework.shell.command.annotation.Option;
121120
122- @ShellComponent
121+ @Command
123122public class MyCommands {
124123
125- @ShellMethod(key = "hello-world")
124+ @Command(command = "hello-world")
126125 public String helloWorld(
127- @ShellOption (defaultValue = "spring") String arg
126+ @Option (defaultValue = "spring") String arg
128127 ) {
129128 return "Hello world " + arg;
130129 }
0 commit comments