fix: conform to the new tea.Model interface

This commit is contained in:
Ayman Bagabas 2024-05-13 13:18:08 -04:00
commit bb6a1e5561
No known key found for this signature in database
GPG key ID: C8D51D2157C919AC

View file

@ -229,7 +229,7 @@ func newModel(cfg Config) tea.Model {
}
}
func (m model) Init() tea.Cmd {
func (m model) Init(tea.Context) (tea.Model, tea.Cmd) {
var cmds []tea.Cmd
d := m.common.cfg.DocumentTypes
@ -244,10 +244,10 @@ func (m model) Init() tea.Cmd {
cmds = append(cmds, findLocalFiles(m))
}
return tea.Batch(cmds...)
return m, tea.Batch(cmds...)
}
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
func (m model) Update(ctx tea.Context, msg tea.Msg) (tea.Model, tea.Cmd) {
// If there's been an error, any key exits
if m.fatalErr != nil {
if _, ok := msg.(tea.KeyMsg); ok {
@ -446,7 +446,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, tea.Batch(cmds...)
}
func (m model) View() string {
func (m model) View(ctx tea.Context) string {
if m.fatalErr != nil {
return errorView(m.fatalErr, true)
}