Skip to content

Commit

Permalink
fix: bind status to events
Browse files Browse the repository at this point in the history
  • Loading branch information
PhearZero committed Oct 21, 2024
1 parent 2cdf16b commit 1816973
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ var statusCmd = &cobra.Command{
view := ui.MakeStatusViewModel(&state)

p := tea.NewProgram(view, tea.WithAltScreen())

go func() {
state.Watch(func(status *internal.StateModel, err error) {
cobra.CheckErr(err)
p.Send(state)
}, context.Background(), client)
}()
// Execute the Command
if _, err := p.Run(); err != nil {
fmt.Printf("Alas, there's been an error: %v", err)
Expand Down

0 comments on commit 1816973

Please sign in to comment.