18 lines
312 B
Go
18 lines
312 B
Go
package tui
|
|
|
|
import tea "github.com/charmbracelet/bubbletea"
|
|
|
|
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|
switch msg := msg.(type) {
|
|
case tea.KeyMsg:
|
|
switch msg.String() {
|
|
case "q", "ctrl+c":
|
|
return m, tea.Quit
|
|
case "up":
|
|
m.count++
|
|
case "down":
|
|
m.count--
|
|
}
|
|
}
|
|
return m, nil
|
|
}
|