Object based Input History of Text-based Prompts#2113
Conversation
|
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. |
|
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. |
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
AI Agents used:
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.