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

@@ -1,6 +1,8 @@
package survey
import (
"time"
"github.com/LazyBachelor/LazyPM/internal/commands/issues"
"github.com/spf13/cobra"
)
@@ -15,11 +17,25 @@ var StatusCmd = &cobra.Command{
func runStatusCmd(cmd *cobra.Command, args []string) error {
app := issues.AppFromContext(cmd.Context())
if app == nil || app.CurrentFeedback == nil {
if app == nil {
cmd.Println("No validation status available.")
return nil
}
if app.SubmitChan != nil {
select {
case app.SubmitChan <- struct{}{}:
default:
}
}
time.Sleep(100 * time.Millisecond)
if app.CurrentFeedback == nil {
cmd.Println("No validation status available yet.")
return nil
}
if app.CurrentFeedback.Message == "" {
cmd.Println("No validation status available yet.")
return nil

View File

@@ -28,6 +28,7 @@ type Check struct {
type ValidatedInterface interface {
Interface
SetChannels(feedbackChan chan ValidationFeedback, quitChan chan bool)
SetSubmitChan(submitChan chan<- struct{})
}
type TaskDetails struct {