Repository navigation
feat: add arrow-key select() and multiselect() to Prompt - #10659
Merged
Merged
Conversation
paulbalandan
force-pushed
the
cli-prompt-select
branch
from
October 25, 2026 15:20
73c2669 to
df1175f
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved input handling and redraw defects can cause incorrect selections, bypass required input, or hang automated commands.
5 open issues
What changed in this PR
Extends the Prompt class introduced in #10655 with interactive single- and multiple-choice menus for the next minor release.
Changes:
- Adds keyboard navigation, scrolling, defaults, and required selections.
- Adds terminal key reading, numbered-input fallbacks, and Ctrl+C cleanup.
- Adds tests, usage examples, and release documentation.
Validation was limited to targeted code inspection; runtime tests and documentation validation remain for CI.
| File | Description |
|---|---|
system/CLI/KeyReader.php |
Reads keypresses and manages terminal mode. |
system/CLI/Prompt.php |
Implements interactive menus and numbered fallbacks. |
tests/system/CLI/PromptTest.php |
Covers navigation, defaults, rendering, and fallback behavior. |
user_guide_src/source/cli/cli_library/026.php |
Demonstrates both selection methods. |
user_guide_src/source/cli/cli_library.rst |
Documents APIs and terminal behavior. |
user_guide_src/source/changelogs/v4.8.0.rst |
Records the new prompt features. |
Review effort: Balanced
paulbalandan
force-pushed
the
cli-prompt-select
branch
from
October 26, 2026 12:14
df1175f to
d42b442
Compare
michalsn
approved these changes
Oct 26, 2026
michalsn
left a comment
Member
There was a problem hiding this comment.
Really nice feature! Also, it looks great.
paulbalandan
force-pushed
the
cli-prompt-select
branch
from
October 27, 2026 07:58
d42b442 to
a71d9b2
Compare
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
Follow-up to #10655. Adds
Prompt::select(), which returns the chosen key, andPrompt::multiselect(), which returns the ticked options and can require at least one.ato toggle all, enter to confirm. Long lists scroll.select.mp4
Demo script (run from the framework root)
Add
-qto see the defaults returned, or pipe the answers to see the numbered fallback:printf '\n\n1,3\n' | php prompt-demo.php.Checklist: