Repository navigation
Conversation
Signed-off-by: David Pilar <david@czpilar.net>
|
Thank you for your PR! The direction is right (bridging I will get back to you once I review this in detail. #1388 might be re-scheduled for a later iteration than 4.0.4. |
|
Thanks @fmbenhassine, no rush, and a later iteration is fine with me. Let me explain the two pieces you mention, since both exist for a rather mechanical reason.
The rest is plumbing: |
Interactive components read keystrokes from a JLine
Terminaland ignore theInputReaderof theCommandContext, so inputs queued throughShellInputProvidernever reach aComponentFlowin a@ShellTest. Without a tty the components skip their read loop and the flow context ends up without their keys. This is option 3 from the discussion in the issue.Changes
ComponentFlow.Builder#inputReader(InputReader)lets a command hand over the reader of itsCommandContext. Kept acrossclone()andreset()like the other builder infrastructure.StringInput,NumberInput,PathInputandConfirmationInputread one line from it and feed it through their existingread()logic, so parsing, default values and validation are unchanged. With a real terminal the reader is ignored.PathSearchopts out and item selectors are not covered; key driven components cannot be expressed as a single line of text.spring-shell-testis untouched and still depends only onspring-shell-core.Notes
CommandContextas a parameter and call.inputReader(commandContext.inputReader()). The reproducer from the issue needs those two lines to pass.ConfirmationInputacceptsy,yes,1andn,no,0; the valuetruefrom the report has never been recognised.Terminalbean is still required. The@ShellTestslice does not provide one; the reproducer gets it from full auto-configuration.Unit tests cover the four components and the flow, and
ComponentFlowShellTestsruns the scenario from the issue end to end. A new section intesting.adocdocuments the usage.Resolves #1383