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.

You can define it with 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();
}

Or with @ShellMethod.

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