For the latest stable version, please use Spring Shell 3.4.0!

Shell Context

The ShellContext interface gives access to a currently running shell context. You can use it to get access to a generic shell options.

InteractionMode is telling if shell is running on a non-interactive or interactive mode.

InteractionMode interactionMode = ctx.getInteractionMode();

Pty is telling if current terminal has a pty features which not a case when output is piped into file or if terminal is run in a ci system.

boolean hasPty = ctx.hasPty();