commands.go

 1package tui
 2
 3import (
 4	"smoothie/tui/bubbles/commits"
 5
 6	tea "github.com/charmbracelet/bubbletea"
 7)
 8
 9type stateMsg struct{ state sessionState }
10type infoMsg struct{ text string }
11type windowMsg struct{}
12type errMsg struct{ err error }
13
14func (e errMsg) Error() string {
15	return e.err.Error()
16}
17
18func (m *Model) windowChangesCmd() tea.Msg {
19	w := <-m.windowChanges
20	m.width = w.Width
21	m.height = w.Height
22	return windowMsg{}
23}
24
25func (m *Model) loadGitCmd() tea.Msg {
26	m.commitTimeline = commits.NewBubble(m.height, 2, 80, m.repoSource.GetCommits(200))
27	m.state = loadedState
28	return nil
29}