change repl and status command to use callback

This commit is contained in:
Robin Olsen
2026-03-04 22:44:01 +01:00
parent 3d183d7fcd
commit 4842d30aab
3 changed files with 28 additions and 2 deletions

View File

@@ -31,6 +31,7 @@ You can also run shell commands directly. Type 'exit' or 'quit' to leave.`
type REPL struct {
feedbackChan chan ValidationFeedback
quitChan chan bool
submitChan chan<- struct{}
app *App
currentFeedback ValidationFeedback
@@ -65,7 +66,11 @@ func (r *REPL) Run(ctx context.Context, config app.Config) error {
// Store app reference for updating feedback
r.app = app
fmt.Println(style.TitleStyle.Render(ReplTitle)) // Print REPL title.
if r.submitChan != nil {
r.app.SubmitChan = r.submitChan
}
fmt.Println(style.TitleStyle.Render(ReplTitle))
// Start goroutine to watch for validation feedback and quit signals
if r.feedbackChan != nil && r.quitChan != nil {
@@ -151,6 +156,10 @@ func (r *REPL) SetChannels(feedbackChan chan task.ValidationFeedback, quitChan c
r.quitChan = quitChan
}
func (r *REPL) SetSubmitChan(submitChan chan<- struct{}) {
r.submitChan = submitChan
}
func (r *REPL) logAction(action string) {
if r.app != nil {
r.app.LogAction(models.EncodeActionEvent(models.ActionEvent{