feat: begin tui implementation

This commit is contained in:
Philip Henning 2025-08-13 14:39:27 +02:00
parent b81f11f711
commit 1b66db10e2
9 changed files with 200 additions and 154 deletions

24
internal/tui/update.go Normal file
View file

@ -0,0 +1,24 @@
package tui
import (
tea "github.com/charmbracelet/bubbletea"
)
// Update handles all messages for the TUI.
func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
var cmd tea.Cmd
switch msg := msg.(type) {
case tea.KeyMsg:
switch msg.String() {
case "q", "ctrl+c":
return m, tea.Quit
}
case tea.WindowSizeMsg:
m.width = msg.Width
m.height = msg.Height
m.list.SetSize(msg.Width/2, msg.Height)
}
m.list, cmd = m.list.Update(msg)
return m, cmd
}