Uploaded image for project: 'Spring Shell'
  1. Spring Shell
  2. SHL-174

Add ability to denote Commands that have multiple steps

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.1.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      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.

        Activity

        Hide
        robinhowlett Robin Howlett added a comment -

        Created pull request SHL-174: Multi-Step Commands #67

        Show
        robinhowlett Robin Howlett added a comment - Created pull request SHL-174: Multi-Step Commands #67

          People

          • Assignee:
            Unassigned
            Reporter:
            robinhowlett Robin Howlett
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: