diff --git a/cmd/soft/browse/browse.go b/cmd/soft/browse/browse.go index eebf28893885e9844dccd6787f03e613c67e8ffd..ecb3d5302d44aebee5147d5540477bd79d4ba6c6 100644 --- a/cmd/soft/browse/browse.go +++ b/cmd/soft/browse/browse.go @@ -5,9 +5,9 @@ import ( "path/filepath" "time" - "github.com/charmbracelet/bubbles/key" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/bubbles/v2/key" + tea "github.com/charmbracelet/bubbletea/v2" + "github.com/charmbracelet/lipgloss/v2" "github.com/charmbracelet/soft-serve/git" "github.com/charmbracelet/soft-serve/pkg/proto" "github.com/charmbracelet/soft-serve/pkg/ui/common" @@ -39,9 +39,8 @@ var Command = &cobra.Command{ // Bubble Tea uses Termenv default output so we have to use the same // thing here. - output := lipgloss.DefaultRenderer() ctx := cmd.Context() - c := common.NewCommon(ctx, output, 0, 0) + c := common.NewCommon(ctx, 0, 0) c.HideCloneCmd = true comps := []common.TabComponent{ repo.NewReadme(c), @@ -152,7 +151,7 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { switch msg := msg.(type) { case tea.WindowSizeMsg: m.SetSize(msg.Width, msg.Height) - case tea.KeyMsg: + case tea.KeyPressMsg: switch { case key.Matches(msg, m.common.KeyMap.Back) && m.error != nil: m.error = nil @@ -166,12 +165,10 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.common.Zone.Close() return m, tea.Quit } - case tea.MouseMsg: - if msg.Action != tea.MouseActionPress { - break - } - switch msg.Button { - case tea.MouseButtonLeft: + case tea.MouseClickMsg: + mouse := msg.Mouse() + switch mouse.Button { + case tea.MouseLeft: switch { case m.common.Zone.Get("footer").InBounds(msg): cmds = append(cmds, footer.ToggleFooterCmd) diff --git a/cmd/soft/hook/hook.go b/cmd/soft/hook/hook.go index e9b3f1f5c1ff6c3ebf40cbf3f5d5160c53ed8953..8a6fb87dc4ca64a9eaf0da1a1ef7fdaf5a8c7faa 100644 --- a/cmd/soft/hook/hook.go +++ b/cmd/soft/hook/hook.go @@ -12,7 +12,7 @@ import ( "path/filepath" "strings" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/cmd" "github.com/charmbracelet/soft-serve/pkg/backend" "github.com/charmbracelet/soft-serve/pkg/config" diff --git a/cmd/soft/main.go b/cmd/soft/main.go index 9849e8a268f22fba46644af33b1ee140f79f16a2..9b248fd37aa641d6d0707004413bf53ad959b4aa 100644 --- a/cmd/soft/main.go +++ b/cmd/soft/main.go @@ -7,7 +7,8 @@ import ( "runtime/debug" "strconv" - "github.com/charmbracelet/log" + "github.com/charmbracelet/colorprofile" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/cmd/soft/admin" "github.com/charmbracelet/soft-serve/cmd/soft/browse" "github.com/charmbracelet/soft-serve/cmd/soft/hook" @@ -18,7 +19,6 @@ import ( "github.com/charmbracelet/soft-serve/pkg/version" mcobra "github.com/muesli/mango-cobra" "github.com/muesli/roff" - "github.com/muesli/termenv" "github.com/spf13/cobra" "go.uber.org/automaxprocs/maxprocs" ) @@ -67,7 +67,7 @@ var ( func init() { if noColor, _ := strconv.ParseBool(os.Getenv("SOFT_SERVE_NO_COLOR")); noColor { - common.DefaultColorProfile = termenv.Ascii + common.DefaultColorProfile = colorprofile.NoTTY } rootCmd.AddCommand( diff --git a/cmd/soft/serve/server.go b/cmd/soft/serve/server.go index 76e55f581234203600edebb4f7b7bcb5d1d155f7..56402f13e0182a0a5e9c0b089727cd398174a731 100644 --- a/cmd/soft/serve/server.go +++ b/cmd/soft/serve/server.go @@ -6,7 +6,7 @@ import ( "fmt" "net/http" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/pkg/backend" "github.com/charmbracelet/soft-serve/pkg/config" diff --git a/go.mod b/go.mod index bbb971c7f45e24d55c50295dd26b1354bd63a219..0a9d3ab30835bed93dc7ad4069bc81a5cca0292c 100644 --- a/go.mod +++ b/go.mod @@ -2,31 +2,33 @@ module github.com/charmbracelet/soft-serve go 1.23.0 -toolchain go1.24.1 - require ( - github.com/charmbracelet/bubbles v0.21.0 - github.com/charmbracelet/bubbletea v1.3.5 - github.com/charmbracelet/glamour v0.10.0 - github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834 - github.com/charmbracelet/wish v1.4.7 github.com/dustin/go-humanize v1.0.1 github.com/go-git/go-git/v5 v5.16.2 github.com/matryer/is v1.4.1 github.com/muesli/reflow v0.3.0 - github.com/muesli/termenv v0.16.0 - github.com/sergi/go-diff v1.4.0 ) require ( github.com/alecthomas/chroma/v2 v2.18.0 + github.com/aymanbagabas/bubblezone/v2 v2.0.0-20250319214444-bb232f16d5e3 +) + +require ( github.com/aymanbagabas/git-module v1.8.4-0.20231101154130-8d27204ac6d2 github.com/caarlos0/duration v0.0.0-20240108180406-5d492514f3c7 - github.com/caarlos0/env/v11 v11.3.1 + github.com/caarlos0/env/v11 v11.2.2 + github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1.0.20250603123720-56bbc4a1ba66 + github.com/charmbracelet/bubbletea/v2 v2.0.0-beta.3.0.20250617194119-3f1d09f7d826 + github.com/charmbracelet/colorprofile v0.3.1 github.com/charmbracelet/git-lfs-transfer v0.1.1-0.20240708204110-bacbfdb68d92 + github.com/charmbracelet/glamour/v2 v2.0.0-20250516160903-6f1e2c8f9ebe github.com/charmbracelet/keygen v0.5.3 - github.com/charmbracelet/log v0.4.2 - github.com/charmbracelet/ssh v0.0.0-20250213143314-8712ec3ff3ef + github.com/charmbracelet/lipgloss/v2 v2.0.0-beta.2.0.20250703152125-8e1c474f8a71 + github.com/charmbracelet/log/v2 v2.0.0-20250226163916-c379e29ff706 + github.com/charmbracelet/ssh v0.0.0-20250128164007-98fd5ae11894 + github.com/charmbracelet/wish/v2 v2.0.0-20250505151211-5996fc7c1f33 + github.com/charmbracelet/x/ansi v0.9.3 github.com/go-jose/go-jose/v3 v3.0.4 github.com/gobwas/glob v0.2.3 github.com/golang-jwt/jwt/v5 v5.2.2 @@ -37,12 +39,12 @@ require ( github.com/hashicorp/golang-lru/v2 v2.0.7 github.com/jmoiron/sqlx v1.4.0 github.com/lib/pq v1.10.9 - github.com/lrstanley/bubblezone v1.0.0 github.com/muesli/mango-cobra v1.2.0 github.com/muesli/roff v0.1.0 github.com/prometheus/client_golang v1.22.0 github.com/robfig/cron/v3 v3.0.1 github.com/rogpeppe/go-internal v1.14.1 + github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 github.com/spf13/cobra v1.9.1 go.uber.org/automaxprocs v1.6.0 golang.org/x/crypto v0.39.0 @@ -54,23 +56,19 @@ require ( require ( github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect github.com/atotto/clipboard v0.1.4 // indirect - github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/aymerick/douceur v0.2.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/charmbracelet/colorprofile v0.3.1 // indirect - github.com/charmbracelet/x/ansi v0.8.0 // indirect - github.com/charmbracelet/x/cellbuf v0.0.13 // indirect + github.com/charmbracelet/x/cellbuf v0.0.14-0.20250516160309-24eee56f89fa // indirect github.com/charmbracelet/x/conpty v0.1.0 // indirect github.com/charmbracelet/x/errors v0.0.0-20240725160154-f9f6568126ec // indirect github.com/charmbracelet/x/exp/slice v0.0.0-20250327172914-2fdc97757edf // indirect - github.com/charmbracelet/x/input v0.3.4 // indirect + github.com/charmbracelet/x/input v0.3.5-0.20250509021451-13796e822d86 // indirect github.com/charmbracelet/x/term v0.2.1 // indirect github.com/charmbracelet/x/termios v0.1.0 // indirect - github.com/charmbracelet/x/windows v0.2.0 // indirect + github.com/charmbracelet/x/windows v0.2.1 // indirect github.com/creack/pty v1.1.21 // indirect github.com/dlclark/regexp2 v1.11.5 // indirect - github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/git-lfs/pktline v0.0.0-20230103162542-ca444d533ef1 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect @@ -79,11 +77,9 @@ require ( github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-localereader v0.0.1 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/mcuadros/go-version v0.0.0-20190830083331-035f6764e8d2 // indirect github.com/microcosm-cc/bluemonday v1.0.27 // indirect - github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect github.com/muesli/cancelreader v0.2.2 // indirect github.com/muesli/mango v0.2.0 // indirect github.com/muesli/mango-pflag v0.1.0 // indirect @@ -102,7 +98,6 @@ require ( golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect golang.org/x/net v0.40.0 // indirect golang.org/x/sys v0.33.0 // indirect - golang.org/x/term v0.32.0 // indirect golang.org/x/text v0.26.0 // indirect golang.org/x/tools v0.33.0 // indirect google.golang.org/protobuf v1.36.5 // indirect diff --git a/go.sum b/go.sum index ea0a226f43db522d88b6ac8dfa9c85679932b91f..db678352e5e86f5a654a991561bd1fa8f448ac90 100644 --- a/go.sum +++ b/go.sum @@ -10,10 +10,10 @@ github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFI github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4= github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= +github.com/aymanbagabas/bubblezone/v2 v2.0.0-20250319214444-bb232f16d5e3 h1:1z2ihw0YUYUhNmRaavyXvG9ZU/9Tj0vj6sA3z5DFIJ8= +github.com/aymanbagabas/bubblezone/v2 v2.0.0-20250319214444-bb232f16d5e3/go.mod h1:sJwqZoo/BSKSizmr0pSJ758RuRsnjlkrOaxPtwlWtOs= github.com/aymanbagabas/git-module v1.8.4-0.20231101154130-8d27204ac6d2 h1:3w5KT+shE3hzWhORGiu2liVjEoaCEXm9uZP47+Gw4So= github.com/aymanbagabas/git-module v1.8.4-0.20231101154130-8d27204ac6d2/go.mod h1:d4gQ7/3/S2sPq4NnKdtAgUOVr6XtLpWFtxyVV5/+76U= -github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= -github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/aymanbagabas/go-udiff v0.2.0 h1:TK0fH4MteXUDspT88n8CKzvK0X9O2xu9yQjWpi6yML8= github.com/aymanbagabas/go-udiff v0.2.0/go.mod h1:RE4Ex0qsGkTAJoQdQQCA0uG+nAzJO/pI/QwceO5fgrA= github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= @@ -22,50 +22,50 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/caarlos0/duration v0.0.0-20240108180406-5d492514f3c7 h1:kJP/C2eL9DCKrCOlX6lPVmAUAb6U4u9xllgws1kP9ds= github.com/caarlos0/duration v0.0.0-20240108180406-5d492514f3c7/go.mod h1:mSkwb/eZEwOJJJ4tqAKiuhLIPe0e9+FKhlU0oMCpbf8= -github.com/caarlos0/env/v11 v11.3.1 h1:cArPWC15hWmEt+gWk7YBi7lEXTXCvpaSdCiZE2X5mCA= -github.com/caarlos0/env/v11 v11.3.1/go.mod h1:qupehSf/Y0TUTsxKywqRt/vJjN5nz6vauiYEUUr8P4U= +github.com/caarlos0/env/v11 v11.2.2 h1:95fApNrUyueipoZN/EhA8mMxiNxrBwDa+oAZrMWl3Kg= +github.com/caarlos0/env/v11 v11.2.2/go.mod h1:JBfcdeQiBoI3Zh1QRAWfe+tpiNTmDtcCj/hHHHMx0vc= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/charmbracelet/bubbles v0.21.0 h1:9TdC97SdRVg/1aaXNVWfFH3nnLAwOXr8Fn6u6mfQdFs= -github.com/charmbracelet/bubbles v0.21.0/go.mod h1:HF+v6QUR4HkEpz62dx7ym2xc71/KBHg+zKwJtMw+qtg= -github.com/charmbracelet/bubbletea v1.3.5 h1:JAMNLTbqMOhSwoELIr0qyP4VidFq72/6E9j7HHmRKQc= -github.com/charmbracelet/bubbletea v1.3.5/go.mod h1:TkCnmH+aBd4LrXhXcqrKiYwRs7qyQx5rBgH5fVY3v54= +github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1.0.20250603123720-56bbc4a1ba66 h1:LDUnLzW0DZ4riy4juBAXJWeE94vvVChgZwzhZL/4wuk= +github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1.0.20250603123720-56bbc4a1ba66/go.mod h1:6HamsBKWqEC/FVHuQMHgQL+knPyvHH55HwJDHl/adMw= +github.com/charmbracelet/bubbletea/v2 v2.0.0-beta.3.0.20250617194119-3f1d09f7d826 h1:pQxCWMojVjHePqGzWsANhplourZYsD6AuR6eR2Hi5yc= +github.com/charmbracelet/bubbletea/v2 v2.0.0-beta.3.0.20250617194119-3f1d09f7d826/go.mod h1:bfzSaUDPMKrWDjD6wo/ato9lfDdEX83rZgwcXHYWJ98= github.com/charmbracelet/colorprofile v0.3.1 h1:k8dTHMd7fgw4bnFd7jXTLZrSU/CQrKnL3m+AxCzDz40= github.com/charmbracelet/colorprofile v0.3.1/go.mod h1:/GkGusxNs8VB/RSOh3fu0TJmQ4ICMMPApIIVn0KszZ0= github.com/charmbracelet/git-lfs-transfer v0.1.1-0.20240708204110-bacbfdb68d92 h1:KtQlsiHfY3K4AoIEh0yUE/wCLHteZ9EzV1hKmx+p7U8= github.com/charmbracelet/git-lfs-transfer v0.1.1-0.20240708204110-bacbfdb68d92/go.mod h1:UrXUCm3xLQkq15fu7qlXHUMlrhdlXHoi13KH2Dfiits= -github.com/charmbracelet/glamour v0.10.0 h1:MtZvfwsYCx8jEPFJm3rIBFIMZUfUJ765oX8V6kXldcY= -github.com/charmbracelet/glamour v0.10.0/go.mod h1:f+uf+I/ChNmqo087elLnVdCiVgjSKWuXa/l6NU2ndYk= +github.com/charmbracelet/glamour/v2 v2.0.0-20250516160903-6f1e2c8f9ebe h1:i6ce4CcAlPpTj2ER69m1DBeLZ3RRcHnKExuwhKa3GfY= +github.com/charmbracelet/glamour/v2 v2.0.0-20250516160903-6f1e2c8f9ebe/go.mod h1:p3Q+aN4eQKeM5jhrmXPMgPrlKbmc59rWSnMsSA3udhk= github.com/charmbracelet/keygen v0.5.3 h1:2MSDC62OUbDy6VmjIE2jM24LuXUvKywLCmaJDmr/Z/4= github.com/charmbracelet/keygen v0.5.3/go.mod h1:TcpNoMAO5GSmhx3SgcEMqCrtn8BahKhB8AlwnLjRUpk= -github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834 h1:ZR7e0ro+SZZiIZD7msJyA+NjkCNNavuiPBLgerbOziE= -github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834/go.mod h1:aKC/t2arECF6rNOnaKaVU6y4t4ZeHQzqfxedE/VkVhA= -github.com/charmbracelet/log v0.4.2 h1:hYt8Qj6a8yLnvR+h7MwsJv/XvmBJXiueUcI3cIxsyig= -github.com/charmbracelet/log v0.4.2/go.mod h1:qifHGX/tc7eluv2R6pWIpyHDDrrb/AG71Pf2ysQu5nw= -github.com/charmbracelet/ssh v0.0.0-20250213143314-8712ec3ff3ef h1:dNZwn4is5svUd+sQEGsrXtp7VwD2ipYaCkKMzcpAEIE= -github.com/charmbracelet/ssh v0.0.0-20250213143314-8712ec3ff3ef/go.mod h1:hg+I6gvlMl16nS9ZzQNgBIrrCasGwEw0QiLsDcP01Ko= -github.com/charmbracelet/wish v1.4.7 h1:O+jdLac3s6GaqkOHHSwezejNK04vl6VjO1A+hl8J8Yc= -github.com/charmbracelet/wish v1.4.7/go.mod h1:OBZ8vC62JC5cvbxJLh+bIWtG7Ctmct+ewziuUWK+G14= -github.com/charmbracelet/x/ansi v0.8.0 h1:9GTq3xq9caJW8ZrBTe0LIe2fvfLR/bYXKTx2llXn7xE= -github.com/charmbracelet/x/ansi v0.8.0/go.mod h1:wdYl/ONOLHLIVmQaxbIYEC/cRKOQyjTkowiI4blgS9Q= -github.com/charmbracelet/x/cellbuf v0.0.13 h1:/KBBKHuVRbq1lYx5BzEHBAFBP8VcQzJejZ/IA3iR28k= -github.com/charmbracelet/x/cellbuf v0.0.13/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs= +github.com/charmbracelet/lipgloss/v2 v2.0.0-beta.2.0.20250703152125-8e1c474f8a71 h1:X0tsNa2UHCKNw+illiavosasVzqioRo32SRV35iwr2I= +github.com/charmbracelet/lipgloss/v2 v2.0.0-beta.2.0.20250703152125-8e1c474f8a71/go.mod h1:EJWvaCrhOhNGVZMvcjc0yVryl4qqpMs8tz0r9WyEkdQ= +github.com/charmbracelet/log/v2 v2.0.0-20250226163916-c379e29ff706 h1:WkwO6Ks3mSIGnGuSdKl9qDSyfbYK50z2wc2gGMggegE= +github.com/charmbracelet/log/v2 v2.0.0-20250226163916-c379e29ff706/go.mod h1:mjJGp00cxcfvD5xdCa+bso251Jt4owrQvuimJtVmEmM= +github.com/charmbracelet/ssh v0.0.0-20250128164007-98fd5ae11894 h1:Ffon9TbltLGBsT6XE//YvNuu4OAaThXioqalhH11xEw= +github.com/charmbracelet/ssh v0.0.0-20250128164007-98fd5ae11894/go.mod h1:hg+I6gvlMl16nS9ZzQNgBIrrCasGwEw0QiLsDcP01Ko= +github.com/charmbracelet/wish/v2 v2.0.0-20250505151211-5996fc7c1f33 h1:/TlxP6Lw9Z7NJCQ7TSbuvfO3/AL0UXGDPwH1zO9pV8U= +github.com/charmbracelet/wish/v2 v2.0.0-20250505151211-5996fc7c1f33/go.mod h1:Tssk2d4IKqV3tNiPgwrYSvJMQu+nN9J4JlGmYaXpiR4= +github.com/charmbracelet/x/ansi v0.9.3 h1:BXt5DHS/MKF+LjuK4huWrC6NCvHtexww7dMayh6GXd0= +github.com/charmbracelet/x/ansi v0.9.3/go.mod h1:3RQDQ6lDnROptfpWuUVIUG64bD2g2BgntdxH0Ya5TeE= +github.com/charmbracelet/x/cellbuf v0.0.14-0.20250516160309-24eee56f89fa h1:lphz0Z3rsiOtMYiz8axkT24i9yFiueDhJbzyNUADmME= +github.com/charmbracelet/x/cellbuf v0.0.14-0.20250516160309-24eee56f89fa/go.mod h1:xBlh2Yi3DL3zy/2n15kITpg0YZardf/aa/hgUaIM6Rk= github.com/charmbracelet/x/conpty v0.1.0 h1:4zc8KaIcbiL4mghEON8D72agYtSeIgq8FSThSPQIb+U= github.com/charmbracelet/x/conpty v0.1.0/go.mod h1:rMFsDJoDwVmiYM10aD4bH2XiRgwI7NYJtQgl5yskjEQ= github.com/charmbracelet/x/errors v0.0.0-20240725160154-f9f6568126ec h1:O8c7pFFK0imuHH5JBqv5smlbVoFn4CZKGjtvCQKu1WE= github.com/charmbracelet/x/errors v0.0.0-20240725160154-f9f6568126ec/go.mod h1:2P0UgXMEa6TsToMSuFqKFQR+fZTO9CNGUNokkPatT/0= -github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payRxjMjKgx2PaCWLZ4p3ro9y97+TVLZNaRZgJwSVDQ= -github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= +github.com/charmbracelet/x/exp/golden v0.0.0-20250207160936-21c02780d27a h1:FsHEJ52OC4VuTzU8t+n5frMjLvpYWEznSr/u8tnkCYw= +github.com/charmbracelet/x/exp/golden v0.0.0-20250207160936-21c02780d27a/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/exp/slice v0.0.0-20250327172914-2fdc97757edf h1:rLG0Yb6MQSDKdB52aGX55JT1oi0P0Kuaj7wi1bLUpnI= github.com/charmbracelet/x/exp/slice v0.0.0-20250327172914-2fdc97757edf/go.mod h1:B3UgsnsBZS/eX42BlaNiJkD1pPOUa+oF1IYC6Yd2CEU= -github.com/charmbracelet/x/input v0.3.4 h1:Mujmnv/4DaitU0p+kIsrlfZl/UlmeLKw1wAP3e1fMN0= -github.com/charmbracelet/x/input v0.3.4/go.mod h1:JI8RcvdZWQIhn09VzeK3hdp4lTz7+yhiEdpEQtZN+2c= +github.com/charmbracelet/x/input v0.3.5-0.20250509021451-13796e822d86 h1:BxAEmOBIDajkgao3EsbBxKQCYvgYPGdT62WASLvtf4Y= +github.com/charmbracelet/x/input v0.3.5-0.20250509021451-13796e822d86/go.mod h1:62Rp/6EtTxoeJDSdtpA3tJp3y3ZRpsiekBSje+K8htA= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= github.com/charmbracelet/x/termios v0.1.0 h1:y4rjAHeFksBAfGbkRDmVinMg7x7DELIGAFbdNvxg97k= github.com/charmbracelet/x/termios v0.1.0/go.mod h1:H/EVv/KRnrYjz+fCYa9bsKdqF3S8ouDK0AZEbG7r+/U= -github.com/charmbracelet/x/windows v0.2.0 h1:ilXA1GJjTNkgOm94CLPeSz7rar54jtFatdmoiONPuEw= -github.com/charmbracelet/x/windows v0.2.0/go.mod h1:ZibNFR49ZFqCXgP76sYanisxRyC+EYrBE7TTknD8s1s= +github.com/charmbracelet/x/windows v0.2.1 h1:3x7vnbpQrjpuq/4L+I4gNsG5htYoCiA5oe9hLjAij5I= +github.com/charmbracelet/x/windows v0.2.1/go.mod h1:ptZp16h40gDYqs5TSawSVW+yiLB13j4kSMA0lSCHL0M= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/creack/pty v1.1.21 h1:1/QdRyBaHHJP61QkWMXlOIBfsgdDeeKfK8SYVUWJKf0= github.com/creack/pty v1.1.21/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= @@ -76,8 +76,6 @@ github.com/dlclark/regexp2 v1.11.5 h1:Q/sSnsKerHeCkc/jSTNq1oCm7KiVgUMZRDUoRu0JQZ github.com/dlclark/regexp2 v1.11.5/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4= -github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/git-lfs/pktline v0.0.0-20230103162542-ca444d533ef1 h1:mtDjlmloH7ytdblogrMz1/8Hqua1y8B4ID+bh3rvod0= @@ -133,16 +131,12 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0 github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lrstanley/bubblezone v1.0.0 h1:bIpUaBilD42rAQwlg/4u5aTqVAt6DSRKYZuSdmkr8UA= -github.com/lrstanley/bubblezone v1.0.0/go.mod h1:kcTekA8HE/0Ll2bWzqHlhA2c513KDNLW7uDfDP4Mly8= github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/matryer/is v1.4.1 h1:55ehd8zaGABKLXQUe2awZ99BD/PTc2ls+KV/dXphgEQ= github.com/matryer/is v1.4.1/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4= -github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88= github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= @@ -153,8 +147,6 @@ github.com/mcuadros/go-version v0.0.0-20190830083331-035f6764e8d2 h1:YocNLcTBdEd github.com/mcuadros/go-version v0.0.0-20190830083331-035f6764e8d2/go.mod h1:76rfSfYPWj01Z85hUf/ituArm797mNKcvINh1OlsZKo= github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk= github.com/microcosm-cc/bluemonday v1.0.27/go.mod h1:jFi9vgW+H7c3V0lb6nR74Ib/DIB5OBs92Dimizgw2cA= -github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI= -github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo= github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= github.com/muesli/mango v0.2.0 h1:iNNc0c5VLQ6fsMgAqGQofByNUBH2Q2nEbD6TaI+5yyQ= @@ -167,8 +159,6 @@ github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= github.com/muesli/roff v0.1.0 h1:YD0lalCotmYuF5HhZliKWlIx7IEhiXeSfq7hNjFqGF8= github.com/muesli/roff v0.1.0/go.mod h1:pjAHQM9hdUUwm/krAfrLGgJkXJ+YuhtsfZ42kieB2Ig= -github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc= -github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4= @@ -200,8 +190,8 @@ github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7 github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sahilm/fuzzy v0.1.1 h1:ceu5RHF8DGgoi+/dR5PsECjCDH1BE3Fnmpo7aVXOdRA= github.com/sahilm/fuzzy v0.1.1/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y= -github.com/sergi/go-diff v1.4.0 h1:n/SP9D5ad1fORl+llWyN+D6qoUETXNZARKjyY2/KVCw= -github.com/sergi/go-diff v1.4.0/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo= github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0= github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= @@ -254,7 +244,6 @@ golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/pkg/backend/auth.go b/pkg/backend/auth.go index 23713347883ddff6c9a2112d27db740f127052c2..7c8158f6d1ad67a580c2f6216b4ad02664f3a94b 100644 --- a/pkg/backend/auth.go +++ b/pkg/backend/auth.go @@ -5,7 +5,7 @@ import ( "crypto/sha256" "encoding/hex" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "golang.org/x/crypto/bcrypt" ) diff --git a/pkg/backend/backend.go b/pkg/backend/backend.go index ba8796b54546620df6b8377704ee5d76b1c10283..579d4cecbbc95118b8af451fdd8c9069d3c29e63 100644 --- a/pkg/backend/backend.go +++ b/pkg/backend/backend.go @@ -3,7 +3,7 @@ package backend import ( "context" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/pkg/config" "github.com/charmbracelet/soft-serve/pkg/db" "github.com/charmbracelet/soft-serve/pkg/store" diff --git a/pkg/backend/webhooks.go b/pkg/backend/webhooks.go index e8e1fe9224f5b2bde6e7cae237599b7912fbcee4..cd3eb07e78ce3016c835c6ae00976f5b33fd427c 100644 --- a/pkg/backend/webhooks.go +++ b/pkg/backend/webhooks.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/pkg/db" "github.com/charmbracelet/soft-serve/pkg/db/models" "github.com/charmbracelet/soft-serve/pkg/proto" diff --git a/pkg/cron/cron.go b/pkg/cron/cron.go index 6fed17b6a15ae6a954e9d6aa8d2418521231b4be..fa290a33e1e826515aeae2fbcd24e78b5a68e95d 100644 --- a/pkg/cron/cron.go +++ b/pkg/cron/cron.go @@ -4,7 +4,7 @@ import ( "context" "time" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/robfig/cron/v3" ) diff --git a/pkg/cron/cron_test.go b/pkg/cron/cron_test.go index c254191b2e45e889b5d2ce3f10fc1c7f16949c83..b8151db55fbbacb7444a87ad67e3f83ba87e6343 100644 --- a/pkg/cron/cron_test.go +++ b/pkg/cron/cron_test.go @@ -6,7 +6,7 @@ import ( "fmt" "testing" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" ) func TestCronLogger(t *testing.T) { diff --git a/pkg/daemon/daemon.go b/pkg/daemon/daemon.go index 3afe5e766b7765fb78321e6d5e80dad1f65e65b4..30faadd7aac103ccf7110b36f402908f3ee67ed1 100644 --- a/pkg/daemon/daemon.go +++ b/pkg/daemon/daemon.go @@ -12,7 +12,7 @@ import ( "sync/atomic" "time" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/pkg/access" "github.com/charmbracelet/soft-serve/pkg/backend" "github.com/charmbracelet/soft-serve/pkg/config" diff --git a/pkg/db/db.go b/pkg/db/db.go index 968d0425afeb65cf7a62d6ebc6c406922178f692..7d5fc2ebea59141c5f40ff83341303792709eebf 100644 --- a/pkg/db/db.go +++ b/pkg/db/db.go @@ -6,7 +6,7 @@ import ( "errors" "fmt" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/pkg/config" "github.com/jmoiron/sqlx" _ "github.com/lib/pq" // postgres driver diff --git a/pkg/db/logger.go b/pkg/db/logger.go index 821576d11990ebb4b14f76c2015d2a6a8c794f5d..605ec133a82c7676c3a7315904bb09a5fb219e5b 100644 --- a/pkg/db/logger.go +++ b/pkg/db/logger.go @@ -5,7 +5,7 @@ import ( "database/sql" "strings" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/jmoiron/sqlx" ) diff --git a/pkg/db/migrate/0003_migrate_lfs_objects.go b/pkg/db/migrate/0003_migrate_lfs_objects.go index d7acd7be715be008c6ad8d261de0af622a6a4496..c89775d8ed0b5fc0f0d414179ff6c3c8f6fc4d4c 100644 --- a/pkg/db/migrate/0003_migrate_lfs_objects.go +++ b/pkg/db/migrate/0003_migrate_lfs_objects.go @@ -6,7 +6,7 @@ import ( "path/filepath" "strconv" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/pkg/config" "github.com/charmbracelet/soft-serve/pkg/db" "github.com/charmbracelet/soft-serve/pkg/db/models" diff --git a/pkg/db/migrate/migrate.go b/pkg/db/migrate/migrate.go index 18bc1780d488d13363e0be7b73768e337a1358e6..8273e454c9b5a8b1ac28edef580147be04dcafee 100644 --- a/pkg/db/migrate/migrate.go +++ b/pkg/db/migrate/migrate.go @@ -6,7 +6,7 @@ import ( "errors" "fmt" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/pkg/db" ) diff --git a/pkg/git/git.go b/pkg/git/git.go index ed922e2649bf8c072a6197315507f465c676b85a..7b18cf22d562ebb638520501309a196a04a86cdb 100644 --- a/pkg/git/git.go +++ b/pkg/git/git.go @@ -9,7 +9,7 @@ import ( "strings" gitm "github.com/aymanbagabas/git-module" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/git" "github.com/go-git/go-git/v5/plumbing/format/pktline" ) diff --git a/pkg/git/lfs.go b/pkg/git/lfs.go index 3d3ae6f7e78f828360ccc11c3ff010e4f59a8438..212ad08041a14b20d54acbd50bf8da942f3e4c9a 100644 --- a/pkg/git/lfs.go +++ b/pkg/git/lfs.go @@ -12,7 +12,7 @@ import ( "time" "github.com/charmbracelet/git-lfs-transfer/transfer" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/pkg/config" "github.com/charmbracelet/soft-serve/pkg/db" "github.com/charmbracelet/soft-serve/pkg/db/models" diff --git a/pkg/git/lfs_auth.go b/pkg/git/lfs_auth.go index edf0785d45e60c20dea26bb998276ec3a67581ac..32a8e6cba7abbc50d7499ba858bdb4ddffc9e83b 100644 --- a/pkg/git/lfs_auth.go +++ b/pkg/git/lfs_auth.go @@ -7,7 +7,7 @@ import ( "fmt" "time" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/pkg/config" "github.com/charmbracelet/soft-serve/pkg/jwk" "github.com/charmbracelet/soft-serve/pkg/lfs" diff --git a/pkg/git/lfs_log.go b/pkg/git/lfs_log.go index 979932d51df6a5cfd9700c12f7d103d2d2a8aed3..fed14ba440aacc986c99e646fbef90e455c266b2 100644 --- a/pkg/git/lfs_log.go +++ b/pkg/git/lfs_log.go @@ -2,7 +2,7 @@ package git import ( "github.com/charmbracelet/git-lfs-transfer/transfer" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" ) type lfsLogger struct { diff --git a/pkg/git/service.go b/pkg/git/service.go index 24576421d4b9a0850501a34143ae6482d4358391..af589c25719320f4c2d8581fe375de32158346b9 100644 --- a/pkg/git/service.go +++ b/pkg/git/service.go @@ -10,7 +10,7 @@ import ( "strings" "sync" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" ) // Service is a Git daemon service. diff --git a/pkg/hooks/gen.go b/pkg/hooks/gen.go index 245e5eb69fe4844c19c721cd7573ff723b9b0aab..d06661be6010efa7ae6acc94e296fd072bae50b1 100644 --- a/pkg/hooks/gen.go +++ b/pkg/hooks/gen.go @@ -7,7 +7,7 @@ import ( "path/filepath" "text/template" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/pkg/config" "github.com/charmbracelet/soft-serve/pkg/utils" ) diff --git a/pkg/jobs/mirror.go b/pkg/jobs/mirror.go index 16ea923418ea49d4a24bf7892257d8a93688e3a6..9ebfdd864e76494b5081bb9ba244947989b591ee 100644 --- a/pkg/jobs/mirror.go +++ b/pkg/jobs/mirror.go @@ -7,7 +7,7 @@ import ( "runtime" "strings" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/git" "github.com/charmbracelet/soft-serve/pkg/backend" "github.com/charmbracelet/soft-serve/pkg/config" diff --git a/pkg/lfs/basic_transfer.go b/pkg/lfs/basic_transfer.go index 609197c1035c176f6d31495d3a8cf57de7f5830c..d3e4100cd3477d77b3fe8a5953882f847336fd53 100644 --- a/pkg/lfs/basic_transfer.go +++ b/pkg/lfs/basic_transfer.go @@ -9,7 +9,7 @@ import ( "io" "net/http" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" ) // BasicTransferAdapter implements the "basic" adapter diff --git a/pkg/lfs/http_client.go b/pkg/lfs/http_client.go index a8b55031f083d1fd5e4b9aaccd896fb50013f41c..c78a2e4b2e061a3f8b9c4a675b4f97226ee209bb 100644 --- a/pkg/lfs/http_client.go +++ b/pkg/lfs/http_client.go @@ -8,7 +8,7 @@ import ( "fmt" "net/http" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" ) // httpClient is a Git LFS client to communicate with a LFS source API. diff --git a/pkg/log/log.go b/pkg/log/log.go index b9134ead76d6d5a96a413cfea5d2202647054374..0c1552589506a2cd82ae11aa77e300218e47d4d6 100644 --- a/pkg/log/log.go +++ b/pkg/log/log.go @@ -5,7 +5,7 @@ import ( "strings" "time" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/pkg/config" ) diff --git a/pkg/ssh/cmd/blob.go b/pkg/ssh/cmd/blob.go index 9678a37a49ce426f3e6a910c04a7f804159d95ee..1aa8fbbe16ffc50c116c4e267f986d20663dcc8f 100644 --- a/pkg/ssh/cmd/blob.go +++ b/pkg/ssh/cmd/blob.go @@ -2,8 +2,8 @@ package cmd import ( "fmt" + "os" - "github.com/charmbracelet/lipgloss" "github.com/charmbracelet/soft-serve/git" "github.com/charmbracelet/soft-serve/pkg/backend" "github.com/charmbracelet/soft-serve/pkg/ui/common" @@ -12,12 +12,16 @@ import ( ) // blobCommand returns a command that prints the contents of a file. -func blobCommand(renderer *lipgloss.Renderer) *cobra.Command { +func blobCommand() *cobra.Command { var linenumber bool var color bool var raw bool + var noColor bool + if testrun, ok := os.LookupEnv("SOFT_SERVE_NO_COLOR"); ok && testrun == "1" { + noColor = true + } - styles := styles.DefaultStyles(renderer) + styles := styles.DefaultStyles() cmd := &cobra.Command{ Use: "blob REPOSITORY [REFERENCE] [PATH]", Aliases: []string{"cat", "show"}, @@ -84,7 +88,7 @@ func blobCommand(renderer *lipgloss.Renderer) *cobra.Command { return fmt.Errorf("binary file: use --raw to print") } } else { - if color { + if color && !noColor { c, err = common.FormatHighlight(fp, c) if err != nil { return err @@ -92,7 +96,7 @@ func blobCommand(renderer *lipgloss.Renderer) *cobra.Command { } if linenumber { - c, _ = common.FormatLineNumber(styles, c, color) + c, _ = common.FormatLineNumber(styles, c, color && !noColor) } cmd.Println(c) diff --git a/pkg/ssh/cmd/commit.go b/pkg/ssh/cmd/commit.go index 52af6725a53692f7310a75cc6efbce33d0c8492b..88fb1b2c8bd310a3b30492c8e67a02d3c37df72d 100644 --- a/pkg/ssh/cmd/commit.go +++ b/pkg/ssh/cmd/commit.go @@ -5,8 +5,7 @@ import ( "strings" "time" - gansi "github.com/charmbracelet/glamour/ansi" - "github.com/charmbracelet/lipgloss" + gansi "github.com/charmbracelet/glamour/v2/ansi" "github.com/charmbracelet/soft-serve/git" "github.com/charmbracelet/soft-serve/pkg/backend" "github.com/charmbracelet/soft-serve/pkg/ui/common" @@ -15,7 +14,7 @@ import ( ) // commitCommand returns a command that prints the contents of a commit. -func commitCommand(renderer *lipgloss.Renderer) *cobra.Command { +func commitCommand() *cobra.Command { var color bool var patchOnly bool @@ -55,7 +54,7 @@ func commitCommand(renderer *lipgloss.Renderer) *cobra.Command { return err } - commonStyle := styles.DefaultStyles(renderer) + commonStyle := styles.DefaultStyles() style := commonStyle.Log s := strings.Builder{} diff --git a/pkg/ssh/cmd/git.go b/pkg/ssh/cmd/git.go index 7265c9a762dd57ec62348b2da960d1ef7cca3651..620b9f0890e2ee4c19b202f9e97eee7ecab325b2 100644 --- a/pkg/ssh/cmd/git.go +++ b/pkg/ssh/cmd/git.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/pkg/access" "github.com/charmbracelet/soft-serve/pkg/backend" "github.com/charmbracelet/soft-serve/pkg/config" diff --git a/pkg/ssh/cmd/repo.go b/pkg/ssh/cmd/repo.go index 6a2bb541e62e5ac97da0516bb28440a91ccfbe19..fa3e72ff9a3098b40314acbca119c86628f9850c 100644 --- a/pkg/ssh/cmd/repo.go +++ b/pkg/ssh/cmd/repo.go @@ -4,14 +4,13 @@ import ( "fmt" "strings" - "github.com/charmbracelet/lipgloss" "github.com/charmbracelet/soft-serve/pkg/backend" "github.com/charmbracelet/soft-serve/pkg/proto" "github.com/spf13/cobra" ) // RepoCommand returns a command for managing repositories. -func RepoCommand(renderer *lipgloss.Renderer) *cobra.Command { +func RepoCommand() *cobra.Command { cmd := &cobra.Command{ Use: "repo", Aliases: []string{"repos", "repository", "repositories"}, @@ -19,10 +18,10 @@ func RepoCommand(renderer *lipgloss.Renderer) *cobra.Command { } cmd.AddCommand( - blobCommand(renderer), + blobCommand(), branchCommand(), collabCommand(), - commitCommand(renderer), + commitCommand(), createCommand(), deleteCommand(), descriptionCommand(), diff --git a/pkg/ssh/cmd/tag.go b/pkg/ssh/cmd/tag.go index 009ac03083a90c6809b61d2c904ae398a59572fe..fc21ce0e4f73a2a340d61ade327ecfd157c1af0e 100644 --- a/pkg/ssh/cmd/tag.go +++ b/pkg/ssh/cmd/tag.go @@ -3,7 +3,7 @@ package cmd import ( "strings" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/git" "github.com/charmbracelet/soft-serve/pkg/backend" "github.com/charmbracelet/soft-serve/pkg/proto" diff --git a/pkg/ssh/cmd/token.go b/pkg/ssh/cmd/token.go index 6fb8295379189c7e42cf26907c26e08862f0da7d..6a11ebfcedbc9a5a3f2aa07ffb4cfb5f997002ad 100644 --- a/pkg/ssh/cmd/token.go +++ b/pkg/ssh/cmd/token.go @@ -6,7 +6,7 @@ import ( "time" "github.com/caarlos0/duration" - "github.com/charmbracelet/lipgloss/table" + "github.com/charmbracelet/lipgloss/v2/table" "github.com/charmbracelet/soft-serve/pkg/backend" "github.com/charmbracelet/soft-serve/pkg/proto" "github.com/dustin/go-humanize" diff --git a/pkg/ssh/cmd/webhooks.go b/pkg/ssh/cmd/webhooks.go index e7409ebbaeafd43b2ad37c48695d2ab1729bccf7..ca6e8978929c1ca283d3b5aff470ffed34358132 100644 --- a/pkg/ssh/cmd/webhooks.go +++ b/pkg/ssh/cmd/webhooks.go @@ -5,7 +5,7 @@ import ( "strconv" "strings" - "github.com/charmbracelet/lipgloss/table" + "github.com/charmbracelet/lipgloss/v2/table" "github.com/charmbracelet/soft-serve/pkg/backend" "github.com/charmbracelet/soft-serve/pkg/webhook" "github.com/dustin/go-humanize" diff --git a/pkg/ssh/middleware.go b/pkg/ssh/middleware.go index 1bd93f99c0c81122f18c956056fa07cebaedee96..32c31af933a807bef2de20dd37e53778a7cb91aa 100644 --- a/pkg/ssh/middleware.go +++ b/pkg/ssh/middleware.go @@ -2,10 +2,9 @@ package ssh import ( "fmt" - "os" "time" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/pkg/backend" "github.com/charmbracelet/soft-serve/pkg/config" "github.com/charmbracelet/soft-serve/pkg/db" @@ -14,9 +13,7 @@ import ( "github.com/charmbracelet/soft-serve/pkg/sshutils" "github.com/charmbracelet/soft-serve/pkg/store" "github.com/charmbracelet/ssh" - "github.com/charmbracelet/wish" - bm "github.com/charmbracelet/wish/bubbletea" - "github.com/muesli/termenv" + "github.com/charmbracelet/wish/v2" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" "github.com/spf13/cobra" @@ -91,12 +88,6 @@ func CommandMiddleware(sh ssh.Handler) ssh.Handler { ctx := s.Context() cfg := config.FromContext(ctx) - renderer := bm.MakeRenderer(s) - if testrun, ok := os.LookupEnv("SOFT_SERVE_NO_COLOR"); ok && testrun == "1" { - // Disable colors when running tests. - renderer.SetColorProfile(termenv.Ascii) - } - args := s.Command() cliCommandCounter.WithLabelValues(cmd.CommandName(args)).Inc() rootCmd := &cobra.Command{ @@ -111,7 +102,7 @@ func CommandMiddleware(sh ssh.Handler) ssh.Handler { cmd.GitUploadPackCommand(), cmd.GitUploadArchiveCommand(), cmd.GitReceivePackCommand(), - cmd.RepoCommand(renderer), + cmd.RepoCommand(), cmd.SettingsCommand(), cmd.UserCommand(), cmd.InfoCommand(), diff --git a/pkg/ssh/session.go b/pkg/ssh/session.go index aecd4619511e977c7367d069d2900fb4b5d1a3f1..892da8bba0de8330c6761e0e30a76adbd80afe12 100644 --- a/pkg/ssh/session.go +++ b/pkg/ssh/session.go @@ -1,19 +1,17 @@ package ssh import ( - "os" "time" - tea "github.com/charmbracelet/bubbletea" + tea "github.com/charmbracelet/bubbletea/v2" "github.com/charmbracelet/soft-serve/pkg/access" "github.com/charmbracelet/soft-serve/pkg/backend" "github.com/charmbracelet/soft-serve/pkg/config" "github.com/charmbracelet/soft-serve/pkg/proto" "github.com/charmbracelet/soft-serve/pkg/ui/common" "github.com/charmbracelet/ssh" - "github.com/charmbracelet/wish" - bm "github.com/charmbracelet/wish/bubbletea" - "github.com/muesli/termenv" + "github.com/charmbracelet/wish/v2" + bm "github.com/charmbracelet/wish/v2/bubbletea" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" ) @@ -54,22 +52,18 @@ func SessionHandler(s ssh.Session) *tea.Program { } } - renderer := bm.MakeRenderer(s) - if testrun, ok := os.LookupEnv("SOFT_SERVE_NO_COLOR"); ok && testrun == "1" { - // Disable colors when running tests. - renderer.SetColorProfile(termenv.Ascii) - } - - c := common.NewCommon(ctx, renderer, pty.Window.Width, pty.Window.Height) - c.SetValue(common.ConfigKey, cfg) - m := NewUI(c, initialRepo) opts := bm.MakeOptions(s) opts = append(opts, tea.WithAltScreen(), tea.WithoutCatchPanics(), tea.WithMouseCellMotion(), tea.WithContext(ctx), + tea.WithColorProfile(common.DefaultColorProfile), ) + + c := common.NewCommon(ctx, pty.Window.Width, pty.Window.Height) + c.SetValue(common.ConfigKey, cfg) + m := NewUI(c, initialRepo) p := tea.NewProgram(m, opts...) tuiSessionCounter.WithLabelValues(initialRepo, pty.Term).Inc() diff --git a/pkg/ssh/session_test.go b/pkg/ssh/session_test.go index 792759c167361c4bd9c10783dda279983e6bc890..f831327450cf92c32188bde1096473274c57e78e 100644 --- a/pkg/ssh/session_test.go +++ b/pkg/ssh/session_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/pkg/backend" "github.com/charmbracelet/soft-serve/pkg/config" "github.com/charmbracelet/soft-serve/pkg/db" @@ -17,10 +17,9 @@ import ( "github.com/charmbracelet/soft-serve/pkg/store/database" "github.com/charmbracelet/soft-serve/pkg/test" "github.com/charmbracelet/ssh" - bm "github.com/charmbracelet/wish/bubbletea" - "github.com/charmbracelet/wish/testsession" + bm "github.com/charmbracelet/wish/v2/bubbletea" + "github.com/charmbracelet/wish/v2/testsession" "github.com/matryer/is" - "github.com/muesli/termenv" gossh "golang.org/x/crypto/ssh" _ "modernc.org/sqlite" // sqlite driver ) @@ -79,7 +78,7 @@ func setup(tb testing.TB) (*gossh.Session, func() error) { be := backend.New(ctx, cfg, dbx, dbstore) ctx = backend.WithContext(ctx, be) return testsession.New(tb, &ssh.Server{ - Handler: ContextMiddleware(cfg, dbx, dbstore, be, log.Default())(bm.MiddlewareWithProgramHandler(SessionHandler, termenv.ANSI256)(func(s ssh.Session) { + Handler: ContextMiddleware(cfg, dbx, dbstore, be, log.Default())(bm.MiddlewareWithProgramHandler(SessionHandler)(func(s ssh.Session) { _, _, active := s.Pty() if !active { os.Exit(1) diff --git a/pkg/ssh/ssh.go b/pkg/ssh/ssh.go index f63b0d3897f53b95af494a99ee0a4dc00d872ddf..10d5edee632048c98e83fdfb9609c0426e57f2a0 100644 --- a/pkg/ssh/ssh.go +++ b/pkg/ssh/ssh.go @@ -5,22 +5,20 @@ import ( "fmt" "net" "os" - "runtime" "strconv" "time" "github.com/charmbracelet/keygen" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/pkg/backend" "github.com/charmbracelet/soft-serve/pkg/config" "github.com/charmbracelet/soft-serve/pkg/db" "github.com/charmbracelet/soft-serve/pkg/proto" "github.com/charmbracelet/soft-serve/pkg/store" - "github.com/charmbracelet/soft-serve/pkg/ui/common" "github.com/charmbracelet/ssh" - "github.com/charmbracelet/wish" - bm "github.com/charmbracelet/wish/bubbletea" - rm "github.com/charmbracelet/wish/recover" + "github.com/charmbracelet/wish/v2" + bm "github.com/charmbracelet/wish/v2/bubbletea" + rm "github.com/charmbracelet/wish/v2/recover" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" gossh "golang.org/x/crypto/ssh" @@ -71,7 +69,7 @@ func NewSSHServer(ctx context.Context) (*SSHServer, error) { rm.MiddlewareWithLogger( logger, // BubbleTea middleware. - bm.MiddlewareWithProgramHandler(SessionHandler, common.DefaultColorProfile), + bm.MiddlewareWithProgramHandler(SessionHandler), // CLI middleware. CommandMiddleware, // Logging middleware. @@ -93,11 +91,10 @@ func NewSSHServer(ctx context.Context) (*SSHServer, error) { wish.WithHostKeyPath(cfg.SSH.KeyPath), wish.WithMiddleware(mw...), } - if runtime.GOOS == "windows" { - opts = append(opts, ssh.EmulatePty()) - } else { - opts = append(opts, ssh.AllocatePty()) - } + + // TODO: Support a real PTY in future version. + opts = append(opts, ssh.EmulatePty()) + s.srv, err = wish.NewServer(opts...) if err != nil { return nil, err diff --git a/pkg/ssh/ui.go b/pkg/ssh/ui.go index 31f6a259cc2e677ac6b90ca2667c5ffee105cde4..204b80181e5ea48eefa9a475e9919ad9606367a3 100644 --- a/pkg/ssh/ui.go +++ b/pkg/ssh/ui.go @@ -3,10 +3,10 @@ package ssh import ( "errors" - "github.com/charmbracelet/bubbles/key" - "github.com/charmbracelet/bubbles/list" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/bubbles/v2/key" + "github.com/charmbracelet/bubbles/v2/list" + tea "github.com/charmbracelet/bubbletea/v2" + "github.com/charmbracelet/lipgloss/v2" "github.com/charmbracelet/soft-serve/git" "github.com/charmbracelet/soft-serve/pkg/proto" "github.com/charmbracelet/soft-serve/pkg/ui/common" @@ -179,40 +179,34 @@ func (ui *UI) Update(msg tea.Msg) (tea.Model, tea.Cmd) { cmds = append(cmds, cmd) } } - case tea.KeyMsg, tea.MouseMsg: - switch msg := msg.(type) { - case tea.KeyMsg: + case tea.KeyPressMsg: + switch { + case key.Matches(msg, ui.common.KeyMap.Back) && ui.error != nil: + ui.error = nil + ui.state = readyState + // Always show the footer on error. + ui.showFooter = ui.footer.ShowAll() + case key.Matches(msg, ui.common.KeyMap.Help): + cmds = append(cmds, footer.ToggleFooterCmd) + case key.Matches(msg, ui.common.KeyMap.Quit): + if !ui.IsFiltering() { + // Stop bubblezone background workers. + ui.common.Zone.Close() + return ui, tea.Quit + } + case ui.activePage == repoPage && + ui.pages[ui.activePage].(*repo.Repo).Path() == "" && + key.Matches(msg, ui.common.KeyMap.Back): + ui.activePage = selectionPage + // Always show the footer on selection page. + ui.showFooter = true + } + case tea.MouseClickMsg: + switch msg.Mouse().Button { + case tea.MouseLeft: switch { - case key.Matches(msg, ui.common.KeyMap.Back) && ui.error != nil: - ui.error = nil - ui.state = readyState - // Always show the footer on error. - ui.showFooter = ui.footer.ShowAll() - case key.Matches(msg, ui.common.KeyMap.Help): + case ui.common.Zone.Get("footer").InBounds(msg): cmds = append(cmds, footer.ToggleFooterCmd) - case key.Matches(msg, ui.common.KeyMap.Quit): - if !ui.IsFiltering() { - // Stop bubblezone background workers. - ui.common.Zone.Close() - return ui, tea.Quit - } - case ui.activePage == repoPage && - ui.pages[ui.activePage].(*repo.Repo).Path() == "" && - key.Matches(msg, ui.common.KeyMap.Back): - ui.activePage = selectionPage - // Always show the footer on selection page. - ui.showFooter = true - } - case tea.MouseMsg: - if msg.Action != tea.MouseActionPress { - break - } - switch msg.Button { - case tea.MouseButtonLeft: - switch { - case ui.common.Zone.Get("footer").InBounds(msg): - cmds = append(cmds, footer.ToggleFooterCmd) - } } } case footer.ToggleFooterMsg: diff --git a/pkg/store/database/database.go b/pkg/store/database/database.go index 02c4bd19cf25e2c3dccd59829eeb71d1947e59af..e41087c7a8dfaa8f14da34715425c0f761d380ba 100644 --- a/pkg/store/database/database.go +++ b/pkg/store/database/database.go @@ -3,7 +3,7 @@ package database import ( "context" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/pkg/config" "github.com/charmbracelet/soft-serve/pkg/db" "github.com/charmbracelet/soft-serve/pkg/store" diff --git a/pkg/ui/common/common.go b/pkg/ui/common/common.go index 93d40f57328aa1d191dc5115e12b16f1f86d0c9d..687939407f8af05cc703dbf0ef1a60cd01302836 100644 --- a/pkg/ui/common/common.go +++ b/pkg/ui/common/common.go @@ -5,16 +5,14 @@ import ( "fmt" "github.com/alecthomas/chroma/v2/lexers" - "github.com/charmbracelet/lipgloss" - "github.com/charmbracelet/log" + zone "github.com/aymanbagabas/bubblezone/v2" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/git" "github.com/charmbracelet/soft-serve/pkg/backend" "github.com/charmbracelet/soft-serve/pkg/config" "github.com/charmbracelet/soft-serve/pkg/ui/keymap" "github.com/charmbracelet/soft-serve/pkg/ui/styles" "github.com/charmbracelet/ssh" - zone "github.com/lrstanley/bubblezone" - "github.com/muesli/termenv" ) type contextKey struct { @@ -34,27 +32,23 @@ type Common struct { Styles *styles.Styles KeyMap *keymap.KeyMap Zone *zone.Manager - Renderer *lipgloss.Renderer - Output *termenv.Output Logger *log.Logger HideCloneCmd bool } // NewCommon returns a new Common struct. -func NewCommon(ctx context.Context, out *lipgloss.Renderer, width, height int) Common { +func NewCommon(ctx context.Context, width, height int) Common { if ctx == nil { ctx = context.TODO() } return Common{ - ctx: ctx, - Width: width, - Height: height, - Renderer: out, - Output: out.Output(), - Styles: styles.DefaultStyles(out), - KeyMap: keymap.DefaultKeyMap(), - Zone: zone.New(), - Logger: log.FromContext(ctx).WithPrefix("ui"), + ctx: ctx, + Width: width, + Height: height, + Styles: styles.DefaultStyles(), + KeyMap: keymap.DefaultKeyMap(), + Zone: zone.New(), + Logger: log.FromContext(ctx).WithPrefix("ui"), } } diff --git a/pkg/ui/common/component.go b/pkg/ui/common/component.go index 6fe7761f9b9c85cabae967b5246d361cb811d363..4b152a4ba81080af791446601d06133847d80102 100644 --- a/pkg/ui/common/component.go +++ b/pkg/ui/common/component.go @@ -1,13 +1,14 @@ package common import ( - "github.com/charmbracelet/bubbles/help" - tea "github.com/charmbracelet/bubbletea" + "github.com/charmbracelet/bubbles/v2/help" + tea "github.com/charmbracelet/bubbletea/v2" ) // Component represents a Bubble Tea model that implements a SetSize function. type Component interface { tea.Model + tea.ViewModel help.KeyMap SetSize(width, height int) } diff --git a/pkg/ui/common/error.go b/pkg/ui/common/error.go index 753f5f26f77fc778157c2dc5d3c7b06440a29b8e..926df1d9ac7610b2a34648290e62c28a7d9d9629 100644 --- a/pkg/ui/common/error.go +++ b/pkg/ui/common/error.go @@ -3,7 +3,7 @@ package common import ( "errors" - tea "github.com/charmbracelet/bubbletea" + tea "github.com/charmbracelet/bubbletea/v2" ) // ErrMissingRepo indicates that the requested repository could not be found. diff --git a/pkg/ui/common/format.go b/pkg/ui/common/format.go index 4344e057d8cfba2478b977a34f01a1d28c1cc6d2..f82c71aec65d6366f3f4d6da770979c94a4d18e4 100644 --- a/pkg/ui/common/format.go +++ b/pkg/ui/common/format.go @@ -6,7 +6,7 @@ import ( "strings" "github.com/alecthomas/chroma/v2/lexers" - gansi "github.com/charmbracelet/glamour/ansi" + gansi "github.com/charmbracelet/glamour/v2/ansi" "github.com/charmbracelet/soft-serve/pkg/ui/styles" ) diff --git a/pkg/ui/common/style.go b/pkg/ui/common/style.go index 06d7ce3d2c9e4b61f2dd827051dd351f4bdca861..1f2032f8b5e0ffbb12c067427c397e34dc55944b 100644 --- a/pkg/ui/common/style.go +++ b/pkg/ui/common/style.go @@ -1,13 +1,13 @@ package common import ( - gansi "github.com/charmbracelet/glamour/ansi" - "github.com/charmbracelet/glamour/styles" - "github.com/muesli/termenv" + "github.com/charmbracelet/colorprofile" + gansi "github.com/charmbracelet/glamour/v2/ansi" + "github.com/charmbracelet/glamour/v2/styles" ) // DefaultColorProfile is the default color profile used by the SSH server. -var DefaultColorProfile = termenv.ANSI256 +var DefaultColorProfile = colorprofile.ANSI256 func strptr(s string) *string { return &s @@ -17,29 +17,20 @@ func strptr(s string) *string { func StyleConfig() gansi.StyleConfig { noColor := strptr("") s := styles.DarkStyleConfig - s.H1.BackgroundColor = noColor - s.H1.Prefix = "# " - s.H1.Suffix = "" - s.H1.Color = strptr("39") - s.Document.StylePrimitive.Color = noColor - s.CodeBlock.Chroma.Text.Color = noColor - s.CodeBlock.Chroma.Name.Color = noColor // This fixes an issue with the default style config. For example // highlighting empty spaces with red in Dockerfile type. s.CodeBlock.Chroma.Error.BackgroundColor = noColor return s } -// StyleRenderer returns a new Glamour renderer with the DefaultColorProfile. +// StyleRenderer returns a new Glamour renderer. func StyleRenderer() gansi.RenderContext { return StyleRendererWithStyles(StyleConfig()) } -// StyleRendererWithStyles returns a new Glamour renderer with the -// DefaultColorProfile and styles. +// StyleRendererWithStyles returns a new Glamour renderer. func StyleRendererWithStyles(styles gansi.StyleConfig) gansi.RenderContext { return gansi.NewRenderContext(gansi.Options{ - ColorProfile: DefaultColorProfile, - Styles: styles, + Styles: styles, }) } diff --git a/pkg/ui/components/code/code.go b/pkg/ui/components/code/code.go index af7697260fc7d327f1791ded0ab84f69f8c86c72..6da77c65fe8040f9bf21c266eafbcf78328613c5 100644 --- a/pkg/ui/components/code/code.go +++ b/pkg/ui/components/code/code.go @@ -6,13 +6,12 @@ import ( "sync" "github.com/alecthomas/chroma/v2/lexers" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/glamour" - gansi "github.com/charmbracelet/glamour/ansi" - "github.com/charmbracelet/lipgloss" + tea "github.com/charmbracelet/bubbletea/v2" + "github.com/charmbracelet/glamour/v2" + gansi "github.com/charmbracelet/glamour/v2/ansi" + "github.com/charmbracelet/lipgloss/v2" "github.com/charmbracelet/soft-serve/pkg/ui/common" vp "github.com/charmbracelet/soft-serve/pkg/ui/components/viewport" - "github.com/muesli/termenv" ) const ( @@ -77,7 +76,11 @@ func (r *Code) SetSideNote(s string) tea.Cmd { // Init implements tea.Model. func (r *Code) Init() tea.Cmd { - w := r.common.Width + // XXX: We probably won't need the GetHorizontalFrameSize margin + // subtraction if we get the new viewport soft wrapping to play nicely with + // Glamour. This also introduces a bug where when it soft wraps, the + // viewport scrolls left/right for 2 columns on each side of the screen. + w := r.common.Width - r.common.Styles.App.GetHorizontalFrameSize() content := r.content if content == "" { r.Viewport.Model.SetContent(r.NoContentStyle.String()) @@ -110,7 +113,7 @@ func (r *Code) Init() tea.Cmd { if r.sidenote != "" { lines := strings.Split(r.sidenote, "\n") - sideNoteWidth := int(math.Ceil(float64(r.Model.Width) * r.SideNotePercent)) + sideNoteWidth := int(math.Ceil(float64(r.Model.Width()) * r.SideNotePercent)) for i, l := range lines { lines[i] = common.TruncateString(l, sideNoteWidth) } @@ -121,7 +124,7 @@ func (r *Code) Init() tea.Cmd { // https://github.com/muesli/reflow/issues/43 // // TODO: solve this upstream in Glamour/Reflow. - content = r.common.Renderer.NewStyle().Width(w).Render(content) + content = lipgloss.NewStyle().Width(w).Render(content) r.Viewport.Model.SetContent(content) @@ -169,26 +172,6 @@ func (r *Code) HalfViewUp() { r.Viewport.HalfViewUp() } -// ViewUp moves the viewport up by a page. -func (r *Code) ViewUp() []string { - return r.Viewport.ViewUp() -} - -// ViewDown moves the viewport down by a page. -func (r *Code) ViewDown() []string { - return r.Viewport.ViewDown() -} - -// LineUp moves the viewport up by the given number of lines. -func (r *Code) LineUp(n int) []string { - return r.Viewport.LineUp(n) -} - -// LineDown moves the viewport down by the given number of lines. -func (r *Code) LineDown(n int) []string { - return r.Viewport.LineDown(n) -} - // ScrollPercent returns the viewport's scroll percentage. func (r *Code) ScrollPercent() float64 { return r.Viewport.ScrollPercent() @@ -244,8 +227,7 @@ func (r *Code) renderFile(path, content string) (string, error) { var m uint st.CodeBlock.Margin = &m rc = gansi.NewRenderContext(gansi.Options{ - ColorProfile: termenv.TrueColor, - Styles: st, + Styles: st, }) } err := formatter.Render(&s, rc) diff --git a/pkg/ui/components/footer/footer.go b/pkg/ui/components/footer/footer.go index 44c800f420e1913c72f1289a00b7d273269a8247..05e1160dedbe717a213de8907fbbb65dccc5bd4e 100644 --- a/pkg/ui/components/footer/footer.go +++ b/pkg/ui/components/footer/footer.go @@ -1,10 +1,10 @@ package footer import ( - "github.com/charmbracelet/bubbles/help" - "github.com/charmbracelet/bubbles/key" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/bubbles/v2/help" + "github.com/charmbracelet/bubbles/v2/key" + tea "github.com/charmbracelet/bubbletea/v2" + "github.com/charmbracelet/lipgloss/v2" "github.com/charmbracelet/soft-serve/pkg/ui/common" ) diff --git a/pkg/ui/components/header/header.go b/pkg/ui/components/header/header.go index 7de511426f6da83252b84884c4fa3a64fd992e65..63e47a4911f6618c31448cdbc8c902e80314be11 100644 --- a/pkg/ui/components/header/header.go +++ b/pkg/ui/components/header/header.go @@ -3,7 +3,7 @@ package header import ( "strings" - tea "github.com/charmbracelet/bubbletea" + tea "github.com/charmbracelet/bubbletea/v2" "github.com/charmbracelet/soft-serve/pkg/ui/common" ) diff --git a/pkg/ui/components/selector/selector.go b/pkg/ui/components/selector/selector.go index 72239d4083847a2ccd72c7d0e10ea9bfa90e10ba..e42ee3507a674a36561ae9255a7b6ea5f2e25c86 100644 --- a/pkg/ui/components/selector/selector.go +++ b/pkg/ui/components/selector/selector.go @@ -3,9 +3,9 @@ package selector import ( "sync" - "github.com/charmbracelet/bubbles/key" - "github.com/charmbracelet/bubbles/list" - tea "github.com/charmbracelet/bubbletea" + "github.com/charmbracelet/bubbles/v2/key" + "github.com/charmbracelet/bubbles/v2/list" + tea "github.com/charmbracelet/bubbletea/v2" "github.com/charmbracelet/soft-serve/pkg/ui/common" ) @@ -230,16 +230,14 @@ func (s *Selector) Init() tea.Cmd { func (s *Selector) Update(msg tea.Msg) (tea.Model, tea.Cmd) { cmds := make([]tea.Cmd, 0) switch msg := msg.(type) { - case tea.MouseMsg: - if msg.Action != tea.MouseActionPress { - break - } - switch msg.Button { - case tea.MouseButtonWheelUp: + case tea.MouseClickMsg: + m := msg.Mouse() + switch m.Button { + case tea.MouseWheelUp: s.CursorUp() - case tea.MouseButtonWheelDown: + case tea.MouseWheelDown: s.CursorDown() - case tea.MouseButtonLeft: + case tea.MouseLeft: curIdx := s.Index() for i, item := range s.Items() { item, _ := item.(IdentifiableItem) @@ -254,7 +252,7 @@ func (s *Selector) Update(msg tea.Msg) (tea.Model, tea.Cmd) { } } } - case tea.KeyMsg: + case tea.KeyPressMsg: filterState := s.FilterState() switch { case key.Matches(msg, s.common.KeyMap.Help): diff --git a/pkg/ui/components/statusbar/statusbar.go b/pkg/ui/components/statusbar/statusbar.go index 20a5735e12da1729616ea9ead98ccfcadfda6a47..f913e644a2230ea4a3d6f1b46f9e7850de45a02e 100644 --- a/pkg/ui/components/statusbar/statusbar.go +++ b/pkg/ui/components/statusbar/statusbar.go @@ -1,10 +1,10 @@ package statusbar import ( - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" + tea "github.com/charmbracelet/bubbletea/v2" + "github.com/charmbracelet/lipgloss/v2" "github.com/charmbracelet/soft-serve/pkg/ui/common" - "github.com/muesli/reflow/truncate" + "github.com/charmbracelet/x/ansi" ) // Model is a status bar model. @@ -75,12 +75,12 @@ func (s *Model) View() string { } branch := st.StatusBarBranch.Render(s.extra) maxWidth := s.common.Width - w(key) - w(info) - w(branch) - w(help) - v := truncate.StringWithTail(s.value, uint(maxWidth-st.StatusBarValue.GetHorizontalFrameSize()), "…") //nolint:gosec + v := ansi.Truncate(s.value, maxWidth-st.StatusBarValue.GetHorizontalFrameSize(), "…") value := st.StatusBarValue. Width(maxWidth). Render(v) - return s.common.Renderer.NewStyle().MaxWidth(s.common.Width). + return lipgloss.NewStyle().MaxWidth(s.common.Width). Render( lipgloss.JoinHorizontal(lipgloss.Top, key, diff --git a/pkg/ui/components/tabs/tabs.go b/pkg/ui/components/tabs/tabs.go index bd31566216326910b991f732813daef756e733f2..36f0a19e85c2bda3dc172e02d8b5bb5b70919ad4 100644 --- a/pkg/ui/components/tabs/tabs.go +++ b/pkg/ui/components/tabs/tabs.go @@ -3,8 +3,8 @@ package tabs import ( "strings" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" + tea "github.com/charmbracelet/bubbletea/v2" + "github.com/charmbracelet/lipgloss/v2" "github.com/charmbracelet/soft-serve/pkg/ui/common" ) @@ -54,7 +54,7 @@ func (t *Tabs) Init() tea.Cmd { func (t *Tabs) Update(msg tea.Msg) (tea.Model, tea.Cmd) { cmds := make([]tea.Cmd, 0) switch msg := msg.(type) { - case tea.KeyMsg: + case tea.KeyPressMsg: switch msg.String() { case "tab": t.activeTab = (t.activeTab + 1) % len(t.tabs) @@ -63,12 +63,9 @@ func (t *Tabs) Update(msg tea.Msg) (tea.Model, tea.Cmd) { t.activeTab = (t.activeTab - 1 + len(t.tabs)) % len(t.tabs) cmds = append(cmds, t.activeTabCmd) } - case tea.MouseMsg: - if msg.Action != tea.MouseActionPress { - break - } + case tea.MouseClickMsg: switch msg.Button { - case tea.MouseButtonLeft: + case tea.MouseLeft: for i, tab := range t.tabs { if t.common.Zone.Get(tab).InBounds(msg) { t.activeTab = i @@ -109,7 +106,7 @@ func (t *Tabs) View() string { s.WriteString(sep.String()) } } - return t.common.Renderer.NewStyle(). + return lipgloss.NewStyle(). MaxWidth(t.common.Width). Render(s.String()) } diff --git a/pkg/ui/components/viewport/viewport.go b/pkg/ui/components/viewport/viewport.go index cd7b6c90951fc4293581ac976eef6dcbf067f637..95bd06bdb8beca22e9f6abda9efba40d4cfbc5b6 100644 --- a/pkg/ui/components/viewport/viewport.go +++ b/pkg/ui/components/viewport/viewport.go @@ -1,9 +1,9 @@ package viewport import ( - "github.com/charmbracelet/bubbles/key" - "github.com/charmbracelet/bubbles/viewport" - tea "github.com/charmbracelet/bubbletea" + "github.com/charmbracelet/bubbles/v2/key" + "github.com/charmbracelet/bubbles/v2/viewport" + tea "github.com/charmbracelet/bubbletea/v2" "github.com/charmbracelet/soft-serve/pkg/ui/common" ) @@ -15,7 +15,9 @@ type Viewport struct { // New returns a new Viewport. func New(c common.Common) *Viewport { - vp := viewport.New(c.Width, c.Height) + vp := viewport.New() + vp.SetWidth(c.Width) + vp.SetHeight(c.Height) vp.MouseWheelEnabled = true return &Viewport{ common: c, @@ -26,8 +28,8 @@ func New(c common.Common) *Viewport { // SetSize implements common.Component. func (v *Viewport) SetSize(width, height int) { v.common.SetSize(width, height) - v.Model.Width = width - v.Model.Height = height + v.Model.SetWidth(width) + v.Model.SetHeight(height) } // Init implements tea.Model. @@ -38,7 +40,7 @@ func (v *Viewport) Init() tea.Cmd { // Update implements tea.Model. func (v *Viewport) Update(msg tea.Msg) (tea.Model, tea.Cmd) { switch msg := msg.(type) { - case tea.KeyMsg: + case tea.KeyPressMsg: switch { case key.Matches(msg, v.common.KeyMap.GotoTop): v.GotoTop() @@ -73,32 +75,12 @@ func (v *Viewport) GotoBottom() { // HalfViewDown moves the viewport down by half the viewport height. func (v *Viewport) HalfViewDown() { - v.Model.HalfViewDown() + v.Model.HalfPageDown() } // HalfViewUp moves the viewport up by half the viewport height. func (v *Viewport) HalfViewUp() { - v.Model.HalfViewUp() -} - -// ViewUp moves the viewport up by a page. -func (v *Viewport) ViewUp() []string { - return v.Model.ViewUp() -} - -// ViewDown moves the viewport down by a page. -func (v *Viewport) ViewDown() []string { - return v.Model.ViewDown() -} - -// LineUp moves the viewport up by the given number of lines. -func (v *Viewport) LineUp(n int) []string { - return v.Model.LineUp(n) -} - -// LineDown moves the viewport down by the given number of lines. -func (v *Viewport) LineDown(n int) []string { - return v.Model.LineDown(n) + v.Model.HalfPageUp() } // ScrollPercent returns the viewport's scroll percentage. diff --git a/pkg/ui/keymap/keymap.go b/pkg/ui/keymap/keymap.go index ae09eaad7344c615d91fd92c92c1b36d634341a1..ad5d8fa736c7c9bda1c8b534d15fed084602ef76 100644 --- a/pkg/ui/keymap/keymap.go +++ b/pkg/ui/keymap/keymap.go @@ -1,6 +1,6 @@ package keymap -import "github.com/charmbracelet/bubbles/key" +import "github.com/charmbracelet/bubbles/v2/key" // KeyMap is a map of key bindings for the UI. type KeyMap struct { diff --git a/pkg/ui/pages/repo/files.go b/pkg/ui/pages/repo/files.go index fd43969fe7d07644542e105985a6081c18b34b58..24275396a925976ebcd0d0babe0690bc34dc707d 100644 --- a/pkg/ui/pages/repo/files.go +++ b/pkg/ui/pages/repo/files.go @@ -7,9 +7,9 @@ import ( "strings" gitm "github.com/aymanbagabas/git-module" - "github.com/charmbracelet/bubbles/key" - "github.com/charmbracelet/bubbles/spinner" - tea "github.com/charmbracelet/bubbletea" + "github.com/charmbracelet/bubbles/v2/key" + "github.com/charmbracelet/bubbles/v2/spinner" + tea "github.com/charmbracelet/bubbletea/v2" "github.com/charmbracelet/soft-serve/git" "github.com/charmbracelet/soft-serve/pkg/proto" "github.com/charmbracelet/soft-serve/pkg/ui/common" @@ -264,7 +264,7 @@ func (f *Files) Update(msg tea.Msg) (tea.Model, tea.Cmd) { case filesViewFiles, filesViewContent: cmds = append(cmds, f.deselectItemCmd()) } - case tea.KeyMsg: + case tea.KeyPressMsg: switch f.activeView { case filesViewFiles: switch { diff --git a/pkg/ui/pages/repo/filesitem.go b/pkg/ui/pages/repo/filesitem.go index ca399fa1b74986f152d7005919048f2ab79762e0..5c3e560f13f76796d4352dfa8e01030698d28594 100644 --- a/pkg/ui/pages/repo/filesitem.go +++ b/pkg/ui/pages/repo/filesitem.go @@ -6,10 +6,10 @@ import ( "io/fs" "strings" - "github.com/charmbracelet/bubbles/key" - "github.com/charmbracelet/bubbles/list" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/bubbles/v2/key" + "github.com/charmbracelet/bubbles/v2/list" + tea "github.com/charmbracelet/bubbletea/v2" + "github.com/charmbracelet/lipgloss/v2" "github.com/charmbracelet/soft-serve/git" "github.com/charmbracelet/soft-serve/pkg/ui/common" "github.com/dustin/go-humanize" @@ -82,7 +82,7 @@ func (d FileItemDelegate) Update(msg tea.Msg, m *list.Model) tea.Cmd { return nil } switch msg := msg.(type) { - case tea.KeyMsg: + case tea.KeyPressMsg: switch { case key.Matches(msg, d.common.KeyMap.Copy): return copyCmd(item.entry.Name(), fmt.Sprintf("File name %q copied to clipboard", item.entry.Name())) @@ -139,7 +139,7 @@ func (d FileItemDelegate) Render(w io.Writer, m list.Model, index int, listItem name = nameStyle.Render(name) size = sizeStyle.Render(size) modeStr := modeStyle.Render(mode.String()) - truncate := d.common.Renderer.NewStyle().MaxWidth(m.Width() - + truncate := lipgloss.NewStyle().MaxWidth(m.Width() - s.Selector.GetHorizontalFrameSize() - s.Selector.GetWidth()) //nolint:errcheck diff --git a/pkg/ui/pages/repo/log.go b/pkg/ui/pages/repo/log.go index 8de8aa78d07c45ecc49529487d2729e089240813..d58118246f2af89de24ecb4e13be368a1b1828c0 100644 --- a/pkg/ui/pages/repo/log.go +++ b/pkg/ui/pages/repo/log.go @@ -5,11 +5,11 @@ import ( "strings" "time" - "github.com/charmbracelet/bubbles/key" - "github.com/charmbracelet/bubbles/spinner" - tea "github.com/charmbracelet/bubbletea" - gansi "github.com/charmbracelet/glamour/ansi" - "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/bubbles/v2/key" + "github.com/charmbracelet/bubbles/v2/spinner" + tea "github.com/charmbracelet/bubbletea/v2" + gansi "github.com/charmbracelet/glamour/v2/ansi" + "github.com/charmbracelet/lipgloss/v2" "github.com/charmbracelet/soft-serve/git" "github.com/charmbracelet/soft-serve/pkg/proto" "github.com/charmbracelet/soft-serve/pkg/ui/common" @@ -221,11 +221,11 @@ func (l *Log) Update(msg tea.Msg) (tea.Model, tea.Cmd) { if i != nil { l.activeCommit = i.(LogItem).Commit } - case tea.KeyMsg, tea.MouseMsg: + case tea.KeyPressMsg, tea.MouseClickMsg: switch l.activeView { case logViewCommits: switch kmsg := msg.(type) { - case tea.KeyMsg: + case tea.KeyPressMsg: switch { case key.Matches(kmsg, l.common.KeyMap.SelectItem): cmds = append(cmds, l.selector.SelectItemCmd) @@ -248,7 +248,7 @@ func (l *Log) Update(msg tea.Msg) (tea.Model, tea.Cmd) { cmds = append(cmds, cmd) case logViewDiff: switch kmsg := msg.(type) { - case tea.KeyMsg: + case tea.KeyPressMsg: switch { case key.Matches(kmsg, l.common.KeyMap.BackItem): l.goBack() diff --git a/pkg/ui/pages/repo/logitem.go b/pkg/ui/pages/repo/logitem.go index 0ff4da6814fd62c8be3fe4e9f4a741ace3cda6ca..1aefd53204ac9288fb6f122efdce0ccd69f81256 100644 --- a/pkg/ui/pages/repo/logitem.go +++ b/pkg/ui/pages/repo/logitem.go @@ -6,10 +6,10 @@ import ( "strings" "time" - "github.com/charmbracelet/bubbles/key" - "github.com/charmbracelet/bubbles/list" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/bubbles/v2/key" + "github.com/charmbracelet/bubbles/v2/list" + tea "github.com/charmbracelet/bubbletea/v2" + "github.com/charmbracelet/lipgloss/v2" "github.com/charmbracelet/soft-serve/git" "github.com/charmbracelet/soft-serve/pkg/ui/common" "github.com/muesli/reflow/truncate" @@ -62,7 +62,7 @@ func (d LogItemDelegate) Update(msg tea.Msg, m *list.Model) tea.Cmd { return nil } switch msg := msg.(type) { - case tea.KeyMsg: + case tea.KeyPressMsg: switch { case key.Matches(msg, d.common.KeyMap.Copy): return copyCmd(item.Hash(), "Commit hash copied to clipboard") diff --git a/pkg/ui/pages/repo/readme.go b/pkg/ui/pages/repo/readme.go index 74c5be2f4dd163466972c31704b130c20d5c3083..8978effcda5e4cac341c95007da99f54f3d926f8 100644 --- a/pkg/ui/pages/repo/readme.go +++ b/pkg/ui/pages/repo/readme.go @@ -4,9 +4,9 @@ import ( "fmt" "path/filepath" - "github.com/charmbracelet/bubbles/key" - "github.com/charmbracelet/bubbles/spinner" - tea "github.com/charmbracelet/bubbletea" + "github.com/charmbracelet/bubbles/v2/key" + "github.com/charmbracelet/bubbles/v2/spinner" + tea "github.com/charmbracelet/bubbletea/v2" "github.com/charmbracelet/soft-serve/pkg/backend" "github.com/charmbracelet/soft-serve/pkg/proto" "github.com/charmbracelet/soft-serve/pkg/ui/common" diff --git a/pkg/ui/pages/repo/refs.go b/pkg/ui/pages/repo/refs.go index f6d9c56d84303d66f9e94aa5aa44e51afb367523..45a6b18d9cd9b33c9590eeca42c49cef5ec3f84f 100644 --- a/pkg/ui/pages/repo/refs.go +++ b/pkg/ui/pages/repo/refs.go @@ -5,9 +5,9 @@ import ( "sort" "strings" - "github.com/charmbracelet/bubbles/key" - "github.com/charmbracelet/bubbles/spinner" - tea "github.com/charmbracelet/bubbletea" + "github.com/charmbracelet/bubbles/v2/key" + "github.com/charmbracelet/bubbles/v2/spinner" + tea "github.com/charmbracelet/bubbletea/v2" "github.com/charmbracelet/soft-serve/git" "github.com/charmbracelet/soft-serve/pkg/proto" "github.com/charmbracelet/soft-serve/pkg/ui/common" @@ -152,7 +152,7 @@ func (r *Refs) Update(msg tea.Msg) (tea.Model, tea.Cmd) { switchTabCmd(&Files{}), ) } - case tea.KeyMsg: + case tea.KeyPressMsg: switch { case key.Matches(msg, r.common.KeyMap.SelectItem): cmds = append(cmds, r.selector.SelectItemCmd) diff --git a/pkg/ui/pages/repo/refsitem.go b/pkg/ui/pages/repo/refsitem.go index 7bb10d6e94fb4013789f6c4f4c4dfd7935d8d09d..e89015049de9e83834b44c4bebee012c34d7bfd6 100644 --- a/pkg/ui/pages/repo/refsitem.go +++ b/pkg/ui/pages/repo/refsitem.go @@ -6,10 +6,10 @@ import ( "strings" "time" - "github.com/charmbracelet/bubbles/key" - "github.com/charmbracelet/bubbles/list" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/bubbles/v2/key" + "github.com/charmbracelet/bubbles/v2/list" + tea "github.com/charmbracelet/bubbletea/v2" + "github.com/charmbracelet/lipgloss/v2" "github.com/charmbracelet/soft-serve/git" "github.com/charmbracelet/soft-serve/pkg/ui/common" "github.com/dustin/go-humanize" @@ -83,7 +83,7 @@ func (d RefItemDelegate) Update(msg tea.Msg, m *list.Model) tea.Cmd { return nil } switch msg := msg.(type) { - case tea.KeyMsg: + case tea.KeyPressMsg: switch { case key.Matches(msg, d.common.KeyMap.Copy): return copyCmd(item.ID(), fmt.Sprintf("Reference %q copied to clipboard", item.ID())) diff --git a/pkg/ui/pages/repo/repo.go b/pkg/ui/pages/repo/repo.go index adeaeed35ccd33460a5358895c286c6b43e70de2..fead336729501513ada5c6d456d58281784f1ddc 100644 --- a/pkg/ui/pages/repo/repo.go +++ b/pkg/ui/pages/repo/repo.go @@ -4,11 +4,11 @@ import ( "fmt" "strings" - "github.com/charmbracelet/bubbles/help" - "github.com/charmbracelet/bubbles/key" - "github.com/charmbracelet/bubbles/spinner" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/bubbles/v2/help" + "github.com/charmbracelet/bubbles/v2/key" + "github.com/charmbracelet/bubbles/v2/spinner" + tea "github.com/charmbracelet/bubbletea/v2" + "github.com/charmbracelet/lipgloss/v2" "github.com/charmbracelet/soft-serve/git" "github.com/charmbracelet/soft-serve/pkg/proto" "github.com/charmbracelet/soft-serve/pkg/ui/common" @@ -171,7 +171,7 @@ func (r *Repo) Update(msg tea.Msg) (tea.Model, tea.Cmd) { } case tabs.ActiveTabMsg: r.activeTab = int(msg) - case tea.KeyMsg, tea.MouseMsg: + case tea.KeyPressMsg, tea.MouseClickMsg: t, cmd := r.tabs.Update(msg) r.tabs = t.(*tabs.Tabs) if cmd != nil { @@ -185,17 +185,14 @@ func (r *Repo) Update(msg tea.Msg) (tea.Model, tea.Cmd) { } } switch msg := msg.(type) { - case tea.MouseMsg: - if msg.Action != tea.MouseActionPress { - break - } + case tea.MouseClickMsg: switch msg.Button { - case tea.MouseButtonLeft: + case tea.MouseLeft: switch { case r.common.Zone.Get("repo-help").InBounds(msg): cmds = append(cmds, footer.ToggleFooterCmd) } - case tea.MouseButtonRight: + case tea.MouseRight: switch { case r.common.Zone.Get("repo-main").InBounds(msg): cmds = append(cmds, goBackCmd) @@ -203,7 +200,7 @@ func (r *Repo) Update(msg tea.Msg) (tea.Model, tea.Cmd) { } } switch msg := msg.(type) { - case tea.KeyMsg: + case tea.KeyPressMsg: switch { case key.Matches(msg, r.common.KeyMap.Back): cmds = append(cmds, goBackCmd) @@ -212,7 +209,7 @@ func (r *Repo) Update(msg tea.Msg) (tea.Model, tea.Cmd) { case CopyMsg: txt := msg.Text if cfg := r.common.Config(); cfg != nil { - r.common.Output.Copy(txt) + cmds = append(cmds, tea.SetClipboard(txt)) } r.statusbar.SetStatus("", msg.Message, "", "") case ReadmeMsg: @@ -274,7 +271,7 @@ func (r *Repo) Update(msg tea.Msg) (tea.Model, tea.Cmd) { // Update the status bar on these events // Must come after we've updated the active tab switch msg.(type) { - case RepoMsg, RefMsg, tabs.ActiveTabMsg, tea.KeyMsg, tea.MouseMsg, + case RepoMsg, RefMsg, tabs.ActiveTabMsg, tea.KeyPressMsg, tea.MouseClickMsg, FileItemsMsg, FileContentMsg, FileBlameMsg, selector.ActiveMsg, LogItemsMsg, GoBackMsg, LogDiffMsg, EmptyRepoMsg, StashListMsg, StashPatchMsg: @@ -326,7 +323,7 @@ func (r *Repo) headerView() string { if r.selectedRepo == nil { return "" } - truncate := r.common.Renderer.NewStyle().MaxWidth(r.common.Width) + truncate := lipgloss.NewStyle().MaxWidth(r.common.Width) header := r.selectedRepo.ProjectName() if header == "" { header = r.selectedRepo.Name() diff --git a/pkg/ui/pages/repo/stash.go b/pkg/ui/pages/repo/stash.go index 667026b7baebc1556a3572049b6a4fb24b40e80a..9d0b874884c5f21534326468c07b159304070999 100644 --- a/pkg/ui/pages/repo/stash.go +++ b/pkg/ui/pages/repo/stash.go @@ -4,10 +4,10 @@ import ( "fmt" gitm "github.com/aymanbagabas/git-module" - "github.com/charmbracelet/bubbles/key" - "github.com/charmbracelet/bubbles/spinner" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/bubbles/v2/key" + "github.com/charmbracelet/bubbles/v2/spinner" + tea "github.com/charmbracelet/bubbletea/v2" + "github.com/charmbracelet/lipgloss/v2" "github.com/charmbracelet/soft-serve/git" "github.com/charmbracelet/soft-serve/pkg/proto" "github.com/charmbracelet/soft-serve/pkg/ui/common" @@ -165,7 +165,7 @@ func (s *Stash) Update(msg tea.Msg) (tea.Model, tea.Cmd) { cmds = append(cmds, cmd) } } - case tea.KeyMsg: + case tea.KeyPressMsg: switch s.state { case stashStateList: switch { diff --git a/pkg/ui/pages/repo/stashitem.go b/pkg/ui/pages/repo/stashitem.go index e6b6a9a822f12310c28b12d7be33e4ce4f517e92..a094040f992a9e7e70f565f92aaf70e14cfc7155 100644 --- a/pkg/ui/pages/repo/stashitem.go +++ b/pkg/ui/pages/repo/stashitem.go @@ -5,9 +5,9 @@ import ( "io" gitm "github.com/aymanbagabas/git-module" - "github.com/charmbracelet/bubbles/key" - "github.com/charmbracelet/bubbles/list" - tea "github.com/charmbracelet/bubbletea" + "github.com/charmbracelet/bubbles/v2/key" + "github.com/charmbracelet/bubbles/v2/list" + tea "github.com/charmbracelet/bubbletea/v2" "github.com/charmbracelet/soft-serve/pkg/ui/common" ) @@ -65,7 +65,7 @@ func (d StashItemDelegate) Update(msg tea.Msg, m *list.Model) tea.Cmd { } switch msg := msg.(type) { - case tea.KeyMsg: + case tea.KeyPressMsg: switch { case key.Matches(msg, d.common.KeyMap.Copy): return copyCmd(item.Title(), fmt.Sprintf("Stash message %q copied to clipboard", item.Title())) diff --git a/pkg/ui/pages/selection/item.go b/pkg/ui/pages/selection/item.go index 1842d7243ac18ac997861a130d5ffc9efb34d51e..7b5b82809f16409c28ccf1666104c2bbf59fbe91 100644 --- a/pkg/ui/pages/selection/item.go +++ b/pkg/ui/pages/selection/item.go @@ -7,10 +7,10 @@ import ( "strings" "time" - "github.com/charmbracelet/bubbles/key" - "github.com/charmbracelet/bubbles/list" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/bubbles/v2/key" + "github.com/charmbracelet/bubbles/v2/list" + tea "github.com/charmbracelet/bubbletea/v2" + "github.com/charmbracelet/lipgloss/v2" "github.com/charmbracelet/soft-serve/pkg/proto" "github.com/charmbracelet/soft-serve/pkg/ui/common" "github.com/dustin/go-humanize" @@ -135,12 +135,14 @@ func (d *ItemDelegate) Update(msg tea.Msg, m *list.Model) tea.Cmd { return nil } switch msg := msg.(type) { - case tea.KeyMsg: + case tea.KeyPressMsg: switch { case key.Matches(msg, d.common.KeyMap.Copy): d.copiedIdx = idx - d.common.Output.Copy(item.Command()) - return m.SetItem(idx, item) + return tea.Batch( + tea.SetClipboard(item.Command()), + m.SetItem(idx, item), + ) } } return nil diff --git a/pkg/ui/pages/selection/selection.go b/pkg/ui/pages/selection/selection.go index 7144244c710c089626502be333b872b22a208ea7..fdabb15137244b36c27df359f4e9acb9cf8d31b7 100644 --- a/pkg/ui/pages/selection/selection.go +++ b/pkg/ui/pages/selection/selection.go @@ -4,10 +4,10 @@ import ( "fmt" "sort" - "github.com/charmbracelet/bubbles/key" - "github.com/charmbracelet/bubbles/list" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/bubbles/v2/key" + "github.com/charmbracelet/bubbles/v2/list" + tea "github.com/charmbracelet/bubbletea/v2" + "github.com/charmbracelet/lipgloss/v2" "github.com/charmbracelet/soft-serve/pkg/access" "github.com/charmbracelet/soft-serve/pkg/backend" "github.com/charmbracelet/soft-serve/pkg/ui/common" @@ -51,7 +51,7 @@ func New(c common.Common) *Selection { ts[i] = b.String() } t := tabs.New(c, ts) - t.TabSeparator = c.Renderer.NewStyle() + t.TabSeparator = lipgloss.NewStyle() t.TabInactive = c.Styles.TopLevelNormalTab t.TabActive = c.Styles.TopLevelActiveTab t.TabDot = c.Styles.TopLevelActiveTabDot @@ -250,9 +250,9 @@ func (s *Selection) Update(msg tea.Msg) (tea.Model, tea.Cmd) { if cmd != nil { cmds = append(cmds, cmd) } - case tea.KeyMsg, tea.MouseMsg: + case tea.KeyPressMsg, tea.MouseMsg: switch msg := msg.(type) { - case tea.KeyMsg: + case tea.KeyPressMsg: switch { case key.Matches(msg, s.common.KeyMap.Back): cmds = append(cmds, s.selector.Init()) @@ -289,15 +289,15 @@ func (s *Selection) View() string { wm, hm := s.getMargins() switch s.activePane { case selectorPane: - ss := s.common.Renderer.NewStyle(). + ss := lipgloss.NewStyle(). Width(s.common.Width - wm). Height(s.common.Height - hm) view = ss.Render(s.selector.View()) case readmePane: - rs := s.common.Renderer.NewStyle(). + rs := lipgloss.NewStyle(). Height(s.common.Height - hm) status := fmt.Sprintf("☰ %.f%%", s.readme.ScrollPercent()*100) - readmeStatus := s.common.Renderer.NewStyle(). + readmeStatus := lipgloss.NewStyle(). Align(lipgloss.Right). Width(s.common.Width - wm). Foreground(s.common.Styles.InactiveBorderColor). diff --git a/pkg/ui/styles/styles.go b/pkg/ui/styles/styles.go index 293b152a2027e9a659242a4219ed7ecbaebaa215..46b8cff040150d5be3d9d98d72a6370bd47c59eb 100644 --- a/pkg/ui/styles/styles.go +++ b/pkg/ui/styles/styles.go @@ -1,7 +1,9 @@ package styles import ( - "github.com/charmbracelet/lipgloss" + "image/color" + + "github.com/charmbracelet/lipgloss/v2" ) // XXX: For now, this is in its own package so that it can be shared between @@ -9,8 +11,8 @@ import ( // Styles defines styles for the UI. type Styles struct { - ActiveBorderColor lipgloss.Color - InactiveBorderColor lipgloss.Color + ActiveBorderColor color.Color + InactiveBorderColor color.Color App lipgloss.Style ServerName lipgloss.Style @@ -165,7 +167,7 @@ type Styles struct { } // DefaultStyles returns default styles for the UI. -func DefaultStyles(r *lipgloss.Renderer) *Styles { +func DefaultStyles() *Styles { highlightColor := lipgloss.Color("210") highlightColorDim := lipgloss.Color("174") selectorColor := lipgloss.Color("167") @@ -176,10 +178,10 @@ func DefaultStyles(r *lipgloss.Renderer) *Styles { s.ActiveBorderColor = lipgloss.Color("62") s.InactiveBorderColor = lipgloss.Color("241") - s.App = r.NewStyle(). + s.App = lipgloss.NewStyle(). Margin(1, 2) - s.ServerName = r.NewStyle(). + s.ServerName = lipgloss.NewStyle(). Height(1). MarginLeft(1). MarginBottom(1). @@ -188,29 +190,29 @@ func DefaultStyles(r *lipgloss.Renderer) *Styles { Foreground(lipgloss.Color("229")). Bold(true) - s.TopLevelNormalTab = r.NewStyle(). + s.TopLevelNormalTab = lipgloss.NewStyle(). MarginRight(2) s.TopLevelActiveTab = s.TopLevelNormalTab. Foreground(lipgloss.Color("36")) - s.TopLevelActiveTabDot = r.NewStyle(). + s.TopLevelActiveTabDot = lipgloss.NewStyle(). Foreground(lipgloss.Color("36")) - s.RepoSelector.Normal.Base = r.NewStyle(). + s.RepoSelector.Normal.Base = lipgloss.NewStyle(). PaddingLeft(1). Border(lipgloss.Border{Left: " "}, false, false, false, true). Height(3) - s.RepoSelector.Normal.Title = r.NewStyle().Bold(true) + s.RepoSelector.Normal.Title = lipgloss.NewStyle().Bold(true) - s.RepoSelector.Normal.Desc = r.NewStyle(). + s.RepoSelector.Normal.Desc = lipgloss.NewStyle(). Foreground(lipgloss.Color("243")) - s.RepoSelector.Normal.Command = r.NewStyle(). + s.RepoSelector.Normal.Command = lipgloss.NewStyle(). Foreground(lipgloss.Color("132")) - s.RepoSelector.Normal.Updated = r.NewStyle(). + s.RepoSelector.Normal.Updated = lipgloss.NewStyle(). Foreground(lipgloss.Color("243")) s.RepoSelector.Active.Base = s.RepoSelector.Normal.Base. @@ -229,78 +231,78 @@ func DefaultStyles(r *lipgloss.Renderer) *Styles { s.RepoSelector.Active.Command = s.RepoSelector.Normal.Command. Foreground(lipgloss.Color("204")) - s.MenuItem = r.NewStyle(). + s.MenuItem = lipgloss.NewStyle(). PaddingLeft(1). Border(lipgloss.Border{ Left: " ", }, false, false, false, true). Height(3) - s.MenuLastUpdate = r.NewStyle(). + s.MenuLastUpdate = lipgloss.NewStyle(). Foreground(lipgloss.Color("241")). Align(lipgloss.Right) - s.Repo.Base = r.NewStyle() + s.Repo.Base = lipgloss.NewStyle() - s.Repo.Title = r.NewStyle(). + s.Repo.Title = lipgloss.NewStyle(). Padding(0, 2) - s.Repo.Command = r.NewStyle(). + s.Repo.Command = lipgloss.NewStyle(). Foreground(lipgloss.Color("168")) - s.Repo.Body = r.NewStyle(). + s.Repo.Body = lipgloss.NewStyle(). Margin(1, 0) - s.Repo.Header = r.NewStyle(). + s.Repo.Header = lipgloss.NewStyle(). MaxHeight(2). Border(lipgloss.NormalBorder(), false, false, true, false). BorderForeground(lipgloss.Color("236")) - s.Repo.HeaderName = r.NewStyle(). + s.Repo.HeaderName = lipgloss.NewStyle(). Foreground(lipgloss.Color("212")). Bold(true) - s.Repo.HeaderDesc = r.NewStyle(). + s.Repo.HeaderDesc = lipgloss.NewStyle(). Foreground(lipgloss.Color("243")) - s.Footer = r.NewStyle(). + s.Footer = lipgloss.NewStyle(). MarginTop(1). Padding(0, 1). Height(1) - s.Branch = r.NewStyle(). + s.Branch = lipgloss.NewStyle(). Foreground(lipgloss.Color("203")). Background(lipgloss.Color("236")). Padding(0, 1) - s.HelpKey = r.NewStyle(). + s.HelpKey = lipgloss.NewStyle(). Foreground(lipgloss.Color("241")) - s.HelpValue = r.NewStyle(). + s.HelpValue = lipgloss.NewStyle(). Foreground(lipgloss.Color("239")) - s.HelpDivider = r.NewStyle(). + s.HelpDivider = lipgloss.NewStyle(). Foreground(lipgloss.Color("237")). SetString(" • ") - s.URLStyle = r.NewStyle(). + s.URLStyle = lipgloss.NewStyle(). MarginLeft(1). Foreground(lipgloss.Color("168")) - s.Error = r.NewStyle(). + s.Error = lipgloss.NewStyle(). MarginTop(2) - s.ErrorTitle = r.NewStyle(). + s.ErrorTitle = lipgloss.NewStyle(). Foreground(lipgloss.Color("230")). Background(lipgloss.Color("204")). Bold(true). Padding(0, 1) - s.ErrorBody = r.NewStyle(). + s.ErrorBody = lipgloss.NewStyle(). Foreground(lipgloss.Color("252")). MarginLeft(2) - s.LogItem.Normal.Base = r.NewStyle(). + s.LogItem.Normal.Base = lipgloss.NewStyle(). Border(lipgloss.Border{ Left: " ", }, false, false, false, true). @@ -315,113 +317,113 @@ func DefaultStyles(r *lipgloss.Renderer) *Styles { s.LogItem.Active.Hash = s.LogItem.Normal.Hash. Foreground(hashColor) - s.LogItem.Active.Hash = r.NewStyle(). + s.LogItem.Active.Hash = lipgloss.NewStyle(). Bold(true). Foreground(highlightColor) - s.LogItem.Normal.Title = r.NewStyle(). + s.LogItem.Normal.Title = lipgloss.NewStyle(). Foreground(lipgloss.Color("105")) - s.LogItem.Active.Title = r.NewStyle(). + s.LogItem.Active.Title = lipgloss.NewStyle(). Foreground(highlightColor). Bold(true) - s.LogItem.Normal.Desc = r.NewStyle(). + s.LogItem.Normal.Desc = lipgloss.NewStyle(). Foreground(lipgloss.Color("246")) - s.LogItem.Active.Desc = r.NewStyle(). + s.LogItem.Active.Desc = lipgloss.NewStyle(). Foreground(lipgloss.Color("95")) s.LogItem.Active.Keyword = s.LogItem.Active.Desc. Foreground(highlightColorDim) - s.LogItem.Normal.Hash = r.NewStyle(). + s.LogItem.Normal.Hash = lipgloss.NewStyle(). Foreground(hashColor) - s.LogItem.Active.Hash = r.NewStyle(). + s.LogItem.Active.Hash = lipgloss.NewStyle(). Foreground(highlightColor) - s.Log.Commit = r.NewStyle(). + s.Log.Commit = lipgloss.NewStyle(). Margin(0, 2) - s.Log.CommitHash = r.NewStyle(). + s.Log.CommitHash = lipgloss.NewStyle(). Foreground(hashColor). Bold(true) - s.Log.CommitBody = r.NewStyle(). + s.Log.CommitBody = lipgloss.NewStyle(). MarginTop(1). MarginLeft(2) - s.Log.CommitStatsAdd = r.NewStyle(). + s.Log.CommitStatsAdd = lipgloss.NewStyle(). Foreground(lipgloss.Color("42")). Bold(true) - s.Log.CommitStatsDel = r.NewStyle(). + s.Log.CommitStatsDel = lipgloss.NewStyle(). Foreground(lipgloss.Color("203")). Bold(true) - s.Log.Paginator = r.NewStyle(). + s.Log.Paginator = lipgloss.NewStyle(). Margin(0). Align(lipgloss.Center) - s.Ref.Normal.Item = r.NewStyle() + s.Ref.Normal.Item = lipgloss.NewStyle() - s.Ref.ItemSelector = r.NewStyle(). + s.Ref.ItemSelector = lipgloss.NewStyle(). Foreground(selectorColor). SetString("> ") - s.Ref.Active.Item = r.NewStyle(). + s.Ref.Active.Item = lipgloss.NewStyle(). Foreground(highlightColorDim) - s.Ref.Normal.Base = r.NewStyle() + s.Ref.Normal.Base = lipgloss.NewStyle() - s.Ref.Active.Base = r.NewStyle() + s.Ref.Active.Base = lipgloss.NewStyle() - s.Ref.Normal.ItemTag = r.NewStyle(). + s.Ref.Normal.ItemTag = lipgloss.NewStyle(). Foreground(lipgloss.Color("39")) - s.Ref.Active.ItemTag = r.NewStyle(). + s.Ref.Active.ItemTag = lipgloss.NewStyle(). Bold(true). Foreground(highlightColor) - s.Ref.Active.Item = r.NewStyle(). + s.Ref.Active.Item = lipgloss.NewStyle(). Bold(true). Foreground(highlightColor) - s.Ref.Normal.ItemDesc = r.NewStyle(). + s.Ref.Normal.ItemDesc = lipgloss.NewStyle(). Faint(true) - s.Ref.Active.ItemDesc = r.NewStyle(). + s.Ref.Active.ItemDesc = lipgloss.NewStyle(). Foreground(highlightColor). Faint(true) - s.Ref.Normal.ItemHash = r.NewStyle(). + s.Ref.Normal.ItemHash = lipgloss.NewStyle(). Foreground(hashColor). Bold(true) - s.Ref.Active.ItemHash = r.NewStyle(). + s.Ref.Active.ItemHash = lipgloss.NewStyle(). Foreground(highlightColor). Bold(true) s.Ref.Paginator = s.Log.Paginator - s.Ref.Selector = r.NewStyle() + s.Ref.Selector = lipgloss.NewStyle() s.Tree.Selector = s.Tree.Normal.FileName. Width(1). Foreground(selectorColor) - s.Tree.Normal.FileName = r.NewStyle(). + s.Tree.Normal.FileName = lipgloss.NewStyle(). MarginLeft(1) s.Tree.Active.FileName = s.Tree.Normal.FileName. Bold(true). Foreground(highlightColor) - s.Tree.Normal.FileDir = r.NewStyle(). + s.Tree.Normal.FileDir = lipgloss.NewStyle(). Foreground(lipgloss.Color("39")) - s.Tree.Active.FileDir = r.NewStyle(). + s.Tree.Active.FileDir = lipgloss.NewStyle(). Foreground(highlightColor) s.Tree.Normal.FileMode = s.Tree.Active.FileName. @@ -437,87 +439,87 @@ func DefaultStyles(r *lipgloss.Renderer) *Styles { s.Tree.Active.FileSize = s.Tree.Normal.FileName. Foreground(highlightColorDim) - s.Tree.FileContent = r.NewStyle() + s.Tree.FileContent = lipgloss.NewStyle() s.Tree.Paginator = s.Log.Paginator - s.Tree.Blame.Hash = r.NewStyle(). + s.Tree.Blame.Hash = lipgloss.NewStyle(). Foreground(hashColor). Bold(true) - s.Tree.Blame.Message = r.NewStyle() + s.Tree.Blame.Message = lipgloss.NewStyle() - s.Tree.Blame.Who = r.NewStyle(). + s.Tree.Blame.Who = lipgloss.NewStyle(). Faint(true) - s.Spinner = r.NewStyle(). + s.Spinner = lipgloss.NewStyle(). MarginTop(1). MarginLeft(2). Foreground(lipgloss.Color("205")) - s.SpinnerContainer = r.NewStyle() + s.SpinnerContainer = lipgloss.NewStyle() - s.NoContent = r.NewStyle(). + s.NoContent = lipgloss.NewStyle(). MarginTop(1). MarginLeft(2). Foreground(lipgloss.Color("242")) - s.StatusBar = r.NewStyle(). + s.StatusBar = lipgloss.NewStyle(). Height(1) - s.StatusBarKey = r.NewStyle(). + s.StatusBarKey = lipgloss.NewStyle(). Bold(true). Padding(0, 1). Background(lipgloss.Color("206")). Foreground(lipgloss.Color("228")) - s.StatusBarValue = r.NewStyle(). + s.StatusBarValue = lipgloss.NewStyle(). Padding(0, 1). Background(lipgloss.Color("235")). Foreground(lipgloss.Color("243")) - s.StatusBarInfo = r.NewStyle(). + s.StatusBarInfo = lipgloss.NewStyle(). Padding(0, 1). Background(lipgloss.Color("212")). Foreground(lipgloss.Color("230")) - s.StatusBarBranch = r.NewStyle(). + s.StatusBarBranch = lipgloss.NewStyle(). Padding(0, 1). Background(lipgloss.Color("62")). Foreground(lipgloss.Color("230")) - s.StatusBarHelp = r.NewStyle(). + s.StatusBarHelp = lipgloss.NewStyle(). Padding(0, 1). Background(lipgloss.Color("237")). Foreground(lipgloss.Color("243")) - s.Tabs = r.NewStyle(). + s.Tabs = lipgloss.NewStyle(). Height(1) - s.TabInactive = r.NewStyle() + s.TabInactive = lipgloss.NewStyle() - s.TabActive = r.NewStyle(). + s.TabActive = lipgloss.NewStyle(). Underline(true). Foreground(lipgloss.Color("36")) - s.TabSeparator = r.NewStyle(). + s.TabSeparator = lipgloss.NewStyle(). SetString("│"). Padding(0, 1). Foreground(lipgloss.Color("238")) - s.Code.LineDigit = r.NewStyle().Foreground(lipgloss.Color("239")) + s.Code.LineDigit = lipgloss.NewStyle().Foreground(lipgloss.Color("239")) - s.Code.LineBar = r.NewStyle().Foreground(lipgloss.Color("236")) + s.Code.LineBar = lipgloss.NewStyle().Foreground(lipgloss.Color("236")) - s.Stash.Normal.Message = r.NewStyle().MarginLeft(1) + s.Stash.Normal.Message = lipgloss.NewStyle().MarginLeft(1) s.Stash.Active.Message = s.Stash.Normal.Message.Foreground(selectorColor) - s.Stash.Title = r.NewStyle(). + s.Stash.Title = lipgloss.NewStyle(). Foreground(hashColor). Bold(true) - s.Stash.Selector = r.NewStyle(). + s.Stash.Selector = lipgloss.NewStyle(). Width(1). Foreground(selectorColor) diff --git a/pkg/web/auth.go b/pkg/web/auth.go index 96b2bab85fcc94200525088d0bf37bac31942bf8..0d8f6d49737b2585cda0720c1567f5e4470cd229 100644 --- a/pkg/web/auth.go +++ b/pkg/web/auth.go @@ -7,7 +7,7 @@ import ( "net/http" "strings" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/pkg/backend" "github.com/charmbracelet/soft-serve/pkg/config" "github.com/charmbracelet/soft-serve/pkg/proto" diff --git a/pkg/web/context.go b/pkg/web/context.go index ccba92776861ac7108851c0ace1845b7a1311936..725e80b201b71ececfd0edc85515d22da1ac4464 100644 --- a/pkg/web/context.go +++ b/pkg/web/context.go @@ -4,7 +4,7 @@ import ( "context" "net/http" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/pkg/backend" "github.com/charmbracelet/soft-serve/pkg/config" "github.com/charmbracelet/soft-serve/pkg/db" diff --git a/pkg/web/git.go b/pkg/web/git.go index 91e4d6e2fe97b5e91ef2bf0d7a37238af368d7cf..b01f3aa519efc87d0081aac6e417832f58cd388a 100644 --- a/pkg/web/git.go +++ b/pkg/web/git.go @@ -14,7 +14,7 @@ import ( "strings" "time" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" gitb "github.com/charmbracelet/soft-serve/git" "github.com/charmbracelet/soft-serve/pkg/access" "github.com/charmbracelet/soft-serve/pkg/backend" diff --git a/pkg/web/git_lfs.go b/pkg/web/git_lfs.go index dccd87f95ea9d0a9d37ea1f1bf62e1c3c8ee3023..9149d4f8ee7a56290b33daf53cec104f4e94c6ab 100644 --- a/pkg/web/git_lfs.go +++ b/pkg/web/git_lfs.go @@ -13,7 +13,7 @@ import ( "strconv" "strings" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/pkg/access" "github.com/charmbracelet/soft-serve/pkg/backend" "github.com/charmbracelet/soft-serve/pkg/config" diff --git a/pkg/web/goget.go b/pkg/web/goget.go index 3c9c49719c0d44ad30fdef5dc9a44492d9e15497..b6678ff9184dd323a232a02d0ee41eb37feffa7e 100644 --- a/pkg/web/goget.go +++ b/pkg/web/goget.go @@ -6,7 +6,7 @@ import ( "path" "text/template" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/pkg/backend" "github.com/charmbracelet/soft-serve/pkg/config" "github.com/charmbracelet/soft-serve/pkg/utils" diff --git a/pkg/web/http.go b/pkg/web/http.go index 20fae6bd176edff577947b56e14722f8f53d8819..0cdc57b1bb087d395b577441d5659b93adbb580b 100644 --- a/pkg/web/http.go +++ b/pkg/web/http.go @@ -5,7 +5,7 @@ import ( "net/http" "time" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/charmbracelet/soft-serve/pkg/config" ) diff --git a/pkg/web/logging.go b/pkg/web/logging.go index 63b6d35e5b5fcf22308fffc7caefe729832d90d5..b9a264f55988d5b6697bae25e38afba276033ca9 100644 --- a/pkg/web/logging.go +++ b/pkg/web/logging.go @@ -7,7 +7,7 @@ import ( "net/http" "time" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/dustin/go-humanize" ) diff --git a/pkg/web/server.go b/pkg/web/server.go index 74a04f5b176bee7d1710f023643436119b181c97..a5cb490ed4b20f54c49f93775affc640594a6970 100644 --- a/pkg/web/server.go +++ b/pkg/web/server.go @@ -4,7 +4,7 @@ import ( "context" "net/http" - "github.com/charmbracelet/log" + "github.com/charmbracelet/log/v2" "github.com/gorilla/handlers" "github.com/gorilla/mux" )