Skip to content

Commit

Permalink
chore: merge branch 'v2-exp' into v2-area
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Feb 4, 2025
2 parents eec8e1c + 3b1b924 commit 4a3501c
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 13 deletions.
4 changes: 2 additions & 2 deletions filepicker/filepicker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
4 changes: 2 additions & 2 deletions progress/progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions stopwatch/stopwatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 9 additions & 2 deletions table/table_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package table

import (
"strings"
"testing"

"github.com/charmbracelet/lipgloss/v2"
Expand Down Expand Up @@ -124,7 +125,7 @@ func TestTableAlignment(t *testing.T) {
{"Hobnobs", "UK", "Yes"},
}),
)
got := ansi.Strip(biscuits.View())
got := ansiStrip(biscuits.View())
golden.RequireEqual(t, []byte(got))
})
t.Run("With border", func(t *testing.T) {
Expand Down Expand Up @@ -153,7 +154,13 @@ func TestTableAlignment(t *testing.T) {
}),
WithStyles(s),
)
got := ansi.Strip(baseStyle.Render(biscuits.View()))
got := ansiStrip(baseStyle.Render(biscuits.View()))
golden.RequireEqual(t, []byte(got))
})
}

func ansiStrip(s string) string {
// Replace all \r\n with \n
s = strings.ReplaceAll(s, "\r\n", "\n")
return ansi.Strip(s)
}
4 changes: 2 additions & 2 deletions timer/timer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions viewport/viewport.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 4a3501c

Please sign in to comment.