Fixed some shit

This commit is contained in:
2025-05-12 20:24:55 -04:00
parent e3271ea47a
commit 0aa8065640
10 changed files with 354 additions and 17 deletions

39
interactive/update.go Normal file
View File

@@ -0,0 +1,39 @@
package interactive
import (
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/huh"
)
func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if msg, ok := msg.(tea.KeyMsg); ok {
switch msg.String() {
case "tab":
if m.Form.GetFocusedField().GetKey() == "format" {
return m, m.Form.NextGroup()
}
c := m.Form.NextField()
return m, c
case "shift+tab":
if m.Form.GetFocusedField().GetKey() == "imgUrl" {
return m, nil
}
c := m.Form.PrevField()
return m, c
case "ctrl+c", "esc":
return m, tea.Quit
case "enter":
return m, nil
default:
form, cmd := m.Form.Update(msg)
m.Form = form.(*huh.Form)
return m, cmd
}
}
return m, nil
}