New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SHL-174: Multi-Step Commands #67

Closed
wants to merge 6 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@robinhowlett

robinhowlett commented Mar 19, 2015

  • Created a new @CliStepIndicator annotation to denote @CliCommand methods that have multiple steps
  • Created a new abstract class AbstractStepExecutionProcessor for permitting step-level control of commands
  • Added StepCommandsTest demonstrating the feature

Robin Howlett added some commits Dec 18, 2014

Robin Howlett
Added @CliStepIndicator annotation to denote @CliCommands that suppor…
…t step processing; added annotation check to AbstractStepExecutionProcessor
Robin Howlett
SHL-174 Added support for step logic by adding
- a @CliStepIndicator annotation
- an abstract class AbstractStepExecutionProcessor implementation of ExecutionProcessor
- exposing the shell logger
- storing if a step result has been handled already
- a test demonstrating it working
@ericbottard

This comment has been minimized.

Show comment
Hide comment
@ericbottard

ericbottard May 13, 2015

Member

Overall, I'm not too keen on adding this to the core of Spring Shell.

It is a rather specific solution to a specific problem and can be implemented without changing the core IMO (there is nothing preventing one from having command classes interact with some shared state that "knows" where we stand in a multi-step process). This could even leverage @CliAvailabilityIndicator.

Also, the provided example (the test) does nor really showcase how the added framework methods

stepConfig = configureStep(stepResult);
stepResult = executeStep(stepResult, stepConfig);
handleStepExecutionResult(invocationContext, stepResult);

are useful. Maybe a more real-world usecase would enlighten me.

Member

ericbottard commented May 13, 2015

Overall, I'm not too keen on adding this to the core of Spring Shell.

It is a rather specific solution to a specific problem and can be implemented without changing the core IMO (there is nothing preventing one from having command classes interact with some shared state that "knows" where we stand in a multi-step process). This could even leverage @CliAvailabilityIndicator.

Also, the provided example (the test) does nor really showcase how the added framework methods

stepConfig = configureStep(stepResult);
stepResult = executeStep(stepResult, stepConfig);
handleStepExecutionResult(invocationContext, stepResult);

are useful. Maybe a more real-world usecase would enlighten me.

@robinhowlett

This comment has been minimized.

Show comment
Hide comment
@robinhowlett

robinhowlett May 13, 2015

@ericbottard I understand your concerns and yes the test is a bit simple to demonstrate the feature.

The main reason I requested/provided this feature was that I was having some difficultly implementing a "user menu"-style of interaction with commands, specifically around commands that were returning data that had natural "next" or "previous" steps that I wanted to allow the user to choose to navigate to.

To show a more real-world use case, I created Mockbin CLI, a Spring Shell application that interacts with Mockbin.

The below GIF demonstrates an example use of a multi-step command. The command executes an request to Mockbin which returns a list of objects, prints those objects to an ASCII table and prompts the user to either enter the row number of an entry to be displayed in JSON, re-print the table, or exit the command execution. (The multiple output format support is part of SHL-175).

CLI Example

robinhowlett commented May 13, 2015

@ericbottard I understand your concerns and yes the test is a bit simple to demonstrate the feature.

The main reason I requested/provided this feature was that I was having some difficultly implementing a "user menu"-style of interaction with commands, specifically around commands that were returning data that had natural "next" or "previous" steps that I wanted to allow the user to choose to navigate to.

To show a more real-world use case, I created Mockbin CLI, a Spring Shell application that interacts with Mockbin.

The below GIF demonstrates an example use of a multi-step command. The command executes an request to Mockbin which returns a list of objects, prints those objects to an ASCII table and prompts the user to either enter the row number of an entry to be displayed in JSON, re-print the table, or exit the command execution. (The multiple output format support is part of SHL-175).

CLI Example

@ericbottard ericbottard referenced this pull request May 13, 2015

Closed

Converse with user mode #69

@ericbottard

This comment has been minimized.

Show comment
Hide comment
@ericbottard

ericbottard Jun 28, 2017

Member

Closing outdated PRs and issues

Member

ericbottard commented Jun 28, 2017

Closing outdated PRs and issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment