Type: New Feature
Affects Version/s: 1.1.0
Fix Version/s: None
Spring Shell provides intercepting the lifecycle of the command being invoked through the ExecutionProcessor interface.
The interface defines three lifecycle events that can be intercepted:
- before a command has been invoked
- after an invocation has been returned
- after an exception was thrown
I'm interested in hooking into the afterReturningInvocation to provide "step logic" - potentially allowing user or system input to execute additional logic based on the result of the initial command result (and/or each step result).
The custom ExecutionProcessor would need to identify which commands are denoted as multi-step - I would suggest a new custom annotation (e.g. @CliStepIndicator) on the command method, which would be available on the ParseResult invocationContext instance passed into the processor methods.
The step logic would be configurable to determine if there are more steps to execute, configure each step in preparation of execution, execute the step, and handle each step execution's result (e.g. logging to the shell), if any.
It should also ensure that the commands original/final result is handled correctly.
An example scenario would be a command that provides links to "next" and "previous" result sets, and for those links to be followed and their step execution results logged to the console.