交互模式
命令注册可以定义 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() {
}