命令注册可以定义用于隐藏命令的命令
取决于 shell 正在执行的模式。在交互模式中对此有更多了解。InteractionMode
您可以使用 来定义它。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() {
}