much better

This commit is contained in:
2026-08-27 18:24:23 +01:00
parent 73c2009139
commit adc276c28a
5 changed files with 118 additions and 33 deletions
+14 -1
View File
@@ -2,15 +2,28 @@ package tui
import (
"fmt"
"os"
tea "charm.land/bubbletea/v2"
)
func Run() error {
p := tea.NewProgram(New())
_, err := p.Run()
m, err := p.Run()
if err != nil {
return fmt.Errorf("tui error: %w", err)
}
if model, ok := m.(Model); ok {
if model.command != "" {
if model.result.Error != nil {
fmt.Fprintf(os.Stderr, "failed: %s\n", model.command)
fmt.Fprintf(os.Stderr, "error: %v\n", model.result.Error)
} else {
fmt.Fprintf(os.Stdout, "%s\n", model.command)
}
}
}
return nil
}