Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
SHL-174: Multi-Step Commands #67
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
are useful. Maybe a more real-world usecase would enlighten me.
@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.
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).