このバージョンはまだ開発中であり、まだ安定しているとは見なされていません。最新の安定バージョンについては、Spring Shell 3.4.1 を使用してください! |
コマンドコンテキスト
The CommandContext interface gives you access to the context of the currently running command. It provides access to the parsed command input, command registry, and other useful information.
@Command(name = "hello")
public void sayHello(CommandContext commandContext) {
// use command context to get options, arguments and output writer
}If you need to print something into a shell, you can get a PrintWriter from the CommandContext and use it to print text. You can find more details about writing into a shell in the 出力の書き方 section.