Interaction Mode

Command registration can define InteractionMode which is used to hide commands depending which mode shell is executing. More about that in Interaction Mode.spring-doc.cn

You can define it with CommandRegisration.spring-doc.cn

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();
}

Or with @ShellMethod.spring-doc.cn

@ShellMethod(key = "mycommand", interactionMode = InteractionMode.INTERACTIVE)
public void mycommand() {
}