Skip to content

Object based Input History of Text-based Prompts#2113

Open
MapelSiroup wants to merge 4 commits into
spectreconsole:mainfrom
MapelSiroup:prompt-input-history-clean
Open

Object based Input History of Text-based Prompts#2113
MapelSiroup wants to merge 4 commits into
spectreconsole:mainfrom
MapelSiroup:prompt-input-history-clean

Conversation

@MapelSiroup

Copy link
Copy Markdown
Contributor

Features

This pull requests allow users to go back and forth in time with their previous validated prompt answers.
Users can use the up and down arrows to go back to previous answers to answer again.
When Flags such as .IsSecret() are set, that prompt's history will not be remembered due to privacy.
Since this new PromptHistory is an object you can have multiple histories within the same program and can communicate between prompt types (such as confirmationprompt and textprompt). History can be reset and can be listed out if need be.

Fixes #158

  • I have read the Contribution Guidelines
  • I have checked that there isn't already another pull request that solves the above issue (sorry my PR is a duplicate by 1 day)
  • All newly added code is adequately covered by tests
  • All existing tests are still running without errors

AI Agents used:

  • Copilot Raptor mini 1x : in-line code completion

Changes

Added PromptHistory.cs
Added extensions such as .DisableHistory() and .History(PromptHistory obj) to valid text-based prompt types.
Multiple History object support. Initialises a default history when no valid is set.
Added EventHandler to notify when a new entry is submited to the history.

Ran tests and all was in working order.


Please upvote 👍 this pull request if you are interested in it.

@patriksvensson

Copy link
Copy Markdown
Contributor

Hey @MapelSiroup, thank you so much for this. I really appreciate you taking the time to work on this issue! Unfortunately, @AntekOlszewski opened a PR for the same issue yesterday (#158), so to be fair to them I'm going to review theirs first.

I'm really sorry for the duplicated effort. That's on us for not marking the issue as being worked on. If their PR ends up not landing for some reason, I'll absolutely come back to yours.

@MapelSiroup

Copy link
Copy Markdown
Contributor Author

Yeah no worries, i also never really ended up pointing out in the initial issue that i started working on it like a week ago, so that's also my fault, i wont take it badly if you dont end up choosing this way or the other, both resolve the issue and his system sounds more lightweight at first glance than my system so its whatever's best for Spectre.Console's paradigm it'll be an improvement either way.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Up key listener for prompt history

2 participants