change repl and status command to use callback
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user