对于最新的稳定版本,请使用 Spring Shell 3.3.3! |
交互模式
命令注册可以定义InteractionMode
用于隐藏命令
取决于正在执行的模式 shell。更多相关信息,请参见 交互模式.
您可以通过以下方式定义它CommandRegisration
.
CommandRegistration commandRegistration() {
return CommandRegistration.builder()
.command("mycommand")
// can be defined for all modes
.interactionMode(InteractionMode.ALL)
// can be defined only for interactive
.interactionMode(InteractionMode.INTERACTIVE)
// can be defined only for non-interactive
.interactionMode(InteractionMode.NONINTERACTIVE)
.build();
}
或者使用@ShellMethod
.
@ShellMethod(key = "mycommand", interactionMode = InteractionMode.INTERACTIVE)
public void mycommand() {
}