This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Shell 3.4.0!

Command Context

The CommandContext interface gives access to a currently running context. You can use it to get access to options:

String arg = ctx.getOptionValue("arg");

If you need to print something into a shell, you can get a Terminal and use its writer to print something:

ctx.getTerminal().writer().println("hi");