refactor!: restore bubbletea model interface

This commit is contained in:
Ayman Bagabas
2025-02-04 13:01:13 -05:00
parent edbb81c136
commit 061e464a70
7 changed files with 13 additions and 11 deletions
+2 -2
View File
@@ -233,8 +233,8 @@ func (m Model) Height() int {
}
// Init initializes the file picker model.
func (m Model) Init() (Model, tea.Cmd) {
return m, m.readDir(m.CurrentDirectory, m.ShowHidden)
func (m Model) Init() tea.Cmd {
return m.readDir(m.CurrentDirectory, m.ShowHidden)
}
// Update handles user interactions within the file picker model.
+1 -1
View File
@@ -5,7 +5,7 @@ go 1.18
require (
github.com/MakeNowJust/heredoc v1.0.0
github.com/atotto/clipboard v0.1.4
github.com/charmbracelet/bubbletea/v2 v2.0.0-alpha.2.0.20250203222705-2e91ec2235cd
github.com/charmbracelet/bubbletea/v2 v2.0.0-alpha.2.0.20250204175057-2a96bc438da6
github.com/charmbracelet/harmonica v0.2.0
github.com/charmbracelet/lipgloss/v2 v2.0.0-alpha.2.0.20250204145343-96725424379d
github.com/charmbracelet/x/ansi v0.8.0
+2
View File
@@ -7,6 +7,8 @@ github.com/aymanbagabas/go-udiff v0.2.0 h1:TK0fH4MteXUDspT88n8CKzvK0X9O2xu9yQjWp
github.com/aymanbagabas/go-udiff v0.2.0/go.mod h1:RE4Ex0qsGkTAJoQdQQCA0uG+nAzJO/pI/QwceO5fgrA=
github.com/charmbracelet/bubbletea/v2 v2.0.0-alpha.2.0.20250203222705-2e91ec2235cd h1:u+kqgSbIL4pnP7huv4kaYUCmuN2L4yyDvdH81QJ4FZ0=
github.com/charmbracelet/bubbletea/v2 v2.0.0-alpha.2.0.20250203222705-2e91ec2235cd/go.mod h1:zaWGYfO6cBtu4dRgGbVN7yMYUz3j9sVIzHy2gn0jdo8=
github.com/charmbracelet/bubbletea/v2 v2.0.0-alpha.2.0.20250204175057-2a96bc438da6 h1:KbLqbYgHC5JZWks50WjBJr92Hs+GpiauwZaDObw9vxE=
github.com/charmbracelet/bubbletea/v2 v2.0.0-alpha.2.0.20250204175057-2a96bc438da6/go.mod h1:zaWGYfO6cBtu4dRgGbVN7yMYUz3j9sVIzHy2gn0jdo8=
github.com/charmbracelet/colorprofile v0.2.0 h1:iiIQlp3LSvoJPtR11KoDfIf9wqWm2mn/iU420rHOZ/A=
github.com/charmbracelet/colorprofile v0.2.0/go.mod h1:6wPrSSR4QtwYtOY3h0bLRw5YOUAIKWlZIJ02CTAsZsk=
github.com/charmbracelet/harmonica v0.2.0 h1:8NxJWRWg/bzKqqEaaeFNipOu77YR5t8aSwG4pgaUBiQ=
+2 -2
View File
@@ -182,8 +182,8 @@ func New(opts ...Option) Model {
}
// Init exists to satisfy the tea.Model interface.
func (m Model) Init() (Model, tea.Cmd) {
return m, nil
func (m Model) Init() tea.Cmd {
return nil
}
// Update is used to animate the progress bar during transitions. Use
+2 -2
View File
@@ -80,8 +80,8 @@ func (m Model) ID() int {
}
// Init starts the stopwatch.
func (m Model) Init() (Model, tea.Cmd) {
return m, m.Start()
func (m Model) Init() tea.Cmd {
return m.Start()
}
// Start starts the stopwatch.
+2 -2
View File
@@ -134,8 +134,8 @@ func (m Model) Timedout() bool {
}
// Init starts the timer.
func (m Model) Init() (Model, tea.Cmd) {
return m, m.tick()
func (m Model) Init() tea.Cmd {
return m.tick()
}
// Update handles the timer tick.
+2 -2
View File
@@ -145,8 +145,8 @@ func (m *Model) setInitialValues() {
}
// Init exists to satisfy the tea.Model interface for composability purposes.
func (m Model) Init() (Model, tea.Cmd) {
return m, nil
func (m Model) Init() tea.Cmd {
return nil
}
// Height returns the height of the viewport.