From 58ba4365910089fc8f2d692c5e775649552b0977 Mon Sep 17 00:00:00 2001 From: bashbunni Date: Tue, 6 May 2025 13:24:45 -0700 Subject: [PATCH 1/7] fix(dep): use v2 bubbletea, lipgloss, and bubbles --- column.go | 34 +++++++++++------- data.go | 5 +-- form.go | 33 ++++++++--------- go.mod | 28 ++++++++++----- go.sum | 57 +++++++++++++++++++++--------- keys.go | 2 +- main.go | 6 ++-- model.go | 103 ++++++++++++++++++++++++++++++++++++++++++++---------- 8 files changed, 188 insertions(+), 80 deletions(-) diff --git a/column.go b/column.go index 8f54d02..c6494c2 100644 --- a/column.go +++ b/column.go @@ -1,10 +1,10 @@ package main import ( - "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" ) const APPEND = -1 @@ -45,7 +45,7 @@ func (c column) Init() tea.Cmd { } // Update handles all the I/O for columns. -func (c column) Update(msg tea.Msg) (tea.Model, tea.Cmd) { +func (c column) Update(msg tea.Msg) (column, tea.Cmd) { var cmd tea.Cmd switch msg := msg.(type) { case tea.WindowSizeMsg: @@ -56,16 +56,24 @@ func (c column) Update(msg tea.Msg) (tea.Model, tea.Cmd) { case key.Matches(msg, keys.Edit): if len(c.list.VisibleItems()) != 0 { task := c.list.SelectedItem().(Task) - f := NewForm(task.title, task.description) - f.index = c.list.Index() - f.col = c - return f.Update(nil) + // return f.Update(nil) + // + return c, func() tea.Msg { + return EditFormMsg{ + title: task.title, + description: task.description, + index: c.list.Index(), + column: c, + } + } } case key.Matches(msg, keys.New): - f := newDefaultForm() - f.index = APPEND - f.col = c - return f.Update(nil) + return c, func() tea.Msg { + return NewFormMsg{ + index: c.list.Index(), + column: c, + } + } case key.Matches(msg, keys.Delete): return c, c.DeleteCurrent() case key.Matches(msg, keys.Enter): diff --git a/data.go b/data.go index 27efb30..42282f4 100644 --- a/data.go +++ b/data.go @@ -1,10 +1,10 @@ package main -import "github.com/charmbracelet/bubbles/list" +import "github.com/charmbracelet/bubbles/v2/list" // Provides the mock data to fill the kanban board -func (b *Board) initLists() { +func (b *Board) initLists() *Board { b.cols = []column{ newColumn(todo), newColumn(inProgress), @@ -27,4 +27,5 @@ func (b *Board) initLists() { b.cols[done].list.SetItems([]list.Item{ Task{status: done, title: "stay cool", description: "as a cucumber"}, }) + return b } diff --git a/form.go b/form.go index 50bfc4d..cbe1739 100644 --- a/form.go +++ b/form.go @@ -1,14 +1,19 @@ package main import ( - "github.com/charmbracelet/bubbles/help" - "github.com/charmbracelet/bubbles/key" - "github.com/charmbracelet/bubbles/textarea" - "github.com/charmbracelet/bubbles/textinput" - 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/textarea" + "github.com/charmbracelet/bubbles/v2/textinput" + tea "github.com/charmbracelet/bubbletea/v2" + "github.com/charmbracelet/lipgloss/v2" ) +type ReturnBoardMsg struct { + abort bool + form Form +} + type Form struct { help help.Model title textinput.Model @@ -17,11 +22,11 @@ type Form struct { index int } -func newDefaultForm() *Form { +func newDefaultForm() Form { return NewForm("task name", "") } -func NewForm(title, description string) *Form { +func NewForm(title, description string) Form { form := Form{ help: help.New(), title: textinput.New(), @@ -30,18 +35,14 @@ func NewForm(title, description string) *Form { form.title.Placeholder = title form.description.Placeholder = description form.title.Focus() - return &form + return form } func (f Form) CreateTask() Task { return Task{f.col.status, f.title.Value(), f.description.Value()} } -func (f Form) Init() tea.Cmd { - return nil -} - -func (f Form) Update(msg tea.Msg) (tea.Model, tea.Cmd) { +func (f Form) Update(msg tea.Msg) (Form, tea.Cmd) { var cmd tea.Cmd switch msg := msg.(type) { case column: @@ -53,7 +54,7 @@ func (f Form) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return f, tea.Quit case key.Matches(msg, keys.Back): - return board.Update(nil) + return f, func() tea.Msg { return ReturnBoardMsg{true, f} } case key.Matches(msg, keys.Enter): if f.title.Focused() { f.title.Blur() @@ -61,7 +62,7 @@ func (f Form) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return f, textarea.Blink } // Return the completed form as a message. - return board.Update(f) + return f, func() tea.Msg { return ReturnBoardMsg{false, f} } } } if f.title.Focused() { diff --git a/go.mod b/go.mod index 0aec6b8..a6c57f5 100644 --- a/go.mod +++ b/go.mod @@ -1,29 +1,39 @@ module github.com/charmbracelet/kancli -go 1.19 +go 1.23.0 + +toolchain go1.24.1 require ( - github.com/charmbracelet/bubbles v0.16.1 + github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1 github.com/charmbracelet/bubbletea v0.24.2 - github.com/charmbracelet/lipgloss v0.7.1 + github.com/charmbracelet/bubbletea/v2 v2.0.0-beta1 + github.com/charmbracelet/lipgloss/v2 v2.0.0-beta1 ) require ( github.com/atotto/clipboard v0.1.4 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect + github.com/charmbracelet/colorprofile v0.3.0 // indirect + github.com/charmbracelet/x/ansi v0.8.0 // indirect + github.com/charmbracelet/x/cellbuf v0.0.13 // indirect + github.com/charmbracelet/x/input v0.3.4 // indirect + github.com/charmbracelet/x/term v0.2.1 // indirect + github.com/charmbracelet/x/windows v0.2.0 // indirect github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/mattn/go-isatty v0.0.19 // indirect github.com/mattn/go-localereader v0.0.1 // indirect - github.com/mattn/go-runewidth v0.0.14 // indirect + github.com/mattn/go-runewidth v0.0.16 // indirect github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect github.com/muesli/cancelreader v0.2.2 // indirect github.com/muesli/reflow v0.3.0 // indirect github.com/muesli/termenv v0.15.1 // indirect - github.com/rivo/uniseg v0.4.4 // indirect - github.com/sahilm/fuzzy v0.1.0 // indirect - golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.9.0 // indirect + github.com/rivo/uniseg v0.4.7 // indirect + github.com/sahilm/fuzzy v0.1.1 // indirect + github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect + golang.org/x/sync v0.12.0 // indirect + golang.org/x/sys v0.31.0 // indirect golang.org/x/term v0.9.0 // indirect - golang.org/x/text v0.10.0 // indirect + golang.org/x/text v0.23.0 // indirect ) diff --git a/go.sum b/go.sum index 7dc5939..2ea6c77 100644 --- a/go.sum +++ b/go.sum @@ -1,16 +1,37 @@ +github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ= +github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE= github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4= github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= 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/charmbracelet/bubbles v0.16.1 h1:6uzpAAaT9ZqKssntbvZMlksWHruQLNxg49H5WdeuYSY= -github.com/charmbracelet/bubbles v0.16.1/go.mod h1:2QCp9LFlEsBQMvIYERr7Ww2H2bA7xen1idUDIzm/+Xc= +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/charmbracelet/bubbles/v2 v2.0.0-beta.1 h1:swACzss0FjnyPz1enfX56GKkLiuKg5FlyVmOLIlU2kE= +github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1/go.mod h1:6HamsBKWqEC/FVHuQMHgQL+knPyvHH55HwJDHl/adMw= github.com/charmbracelet/bubbletea v0.24.2 h1:uaQIKx9Ai6Gdh5zpTbGiWpytMU+CfsPp06RaW2cx/SY= github.com/charmbracelet/bubbletea v0.24.2/go.mod h1:XdrNrV4J8GiyshTtx3DNuYkR1FDaJmO3l2nejekbsgg= -github.com/charmbracelet/lipgloss v0.7.1 h1:17WMwi7N1b1rVWOjMT+rCh7sQkvDU75B2hbZpc5Kc1E= -github.com/charmbracelet/lipgloss v0.7.1/go.mod h1:yG0k3giv8Qj8edTCbbg6AlQ5e8KNWpFujkNawKNhE2c= +github.com/charmbracelet/bubbletea/v2 v2.0.0-beta1 h1:yaxFt97mvofGY7bYZn8U/aSVoamXGE3O4AEvWhshUDI= +github.com/charmbracelet/bubbletea/v2 v2.0.0-beta1/go.mod h1:qbcZLI5z8R49v9xBdU5V5Dh5D2uccx8wSwBqxQyErqc= +github.com/charmbracelet/colorprofile v0.3.0 h1:KtLh9uuu1RCt+Hml4s6Hz+kB1PfV3wi++1h5ia65yKQ= +github.com/charmbracelet/colorprofile v0.3.0/go.mod h1:oHJ340RS2nmG1zRGPmhJKJ/jf4FPNNk0P39/wBPA1G0= +github.com/charmbracelet/lipgloss/v2 v2.0.0-beta1 h1:SOylT6+BQzPHEjn15TIzawBPVD0QmhKXbcb3jY0ZIKU= +github.com/charmbracelet/lipgloss/v2 v2.0.0-beta1/go.mod h1:tRlx/Hu0lo/j9viunCN2H+Ze6JrmdjQlXUQvvArgaOc= +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/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/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/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= +github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= +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/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 h1:q2hJAaP1k2wIvVRd/hEHD7lacgqrCPS+k8g1MndzfWY= github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 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/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= @@ -18,8 +39,8 @@ github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D 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.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= -github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= +github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= 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= @@ -30,17 +51,21 @@ github.com/muesli/termenv v0.15.1 h1:UzuTb/+hhlBugQz28rpzey4ZuKcZ03MeKsoG7IJZIxs github.com/muesli/termenv v0.15.1/go.mod h1:HeAQPTzpfs016yGtA4g00CsdYnVLJvxsS4ANqrZs2sQ= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= -github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/sahilm/fuzzy v0.1.0 h1:FzWGaw2Opqyu+794ZQ9SYifWv2EIXpwP4q8dY1kDAwI= -github.com/sahilm/fuzzy v0.1.0/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/sahilm/fuzzy v0.1.1 h1:ceu5RHF8DGgoi+/dR5PsECjCDH1BE3Fnmpo7aVXOdRA= +github.com/sahilm/fuzzy v0.1.1/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y= +github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= +github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= +golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= +golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= +golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.9.0 h1:GRRCnKYhdQrD8kfRAdQ6Zcw1P0OcELxGLKJvtjVMZ28= golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo= -golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58= -golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= +golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= diff --git a/keys.go b/keys.go index 02ea573..06108f6 100644 --- a/keys.go +++ b/keys.go @@ -1,6 +1,6 @@ package main -import "github.com/charmbracelet/bubbles/key" +import "github.com/charmbracelet/bubbles/v2/key" // ShortHelp returns keybindings to be shown in the mini help view. It's part // of the key.Map interface. diff --git a/main.go b/main.go index d348ae1..2ca85a1 100644 --- a/main.go +++ b/main.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - tea "github.com/charmbracelet/bubbletea" + tea "github.com/charmbracelet/bubbletea/v2" ) type status int @@ -41,9 +41,7 @@ func main() { } defer f.Close() - board = NewBoard() - board.initLists() - p := tea.NewProgram(board) + p := tea.NewProgram(newModel()) if _, err := p.Run(); err != nil { fmt.Println(err) os.Exit(1) diff --git a/model.go b/model.go index f537222..c410079 100644 --- a/model.go +++ b/model.go @@ -1,12 +1,82 @@ package main 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" ) +// TODOs +// - clean up textinput & area placeholder text (form could use some razzle dazzle) - use huh for this instead? +// - get accurate help menu options (not showing options properly) +// - move board to its own file + +type Model struct { + // false is board, true is form + modifying bool + board *Board + form Form +} + +func newModel() Model { + return Model{ + board: NewBoard().initLists(), + form: newDefaultForm(), + } +} + +func (m Model) Init() tea.Cmd { + return nil +} + +func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { + var cmd tea.Cmd + switch msg := msg.(type) { + case ReturnBoardMsg: + m.modifying = false + case NewFormMsg: + m.modifying = true + m.form = newDefaultForm() + m.form.index = APPEND + m.form.col = msg.column + case EditFormMsg: + m.modifying = true + m.form = NewForm(msg.title, msg.description) + m.form.index = msg.index + m.form.col = msg.column + // need to trigger what used to happen when a Form was received as msg. + } + + if m.modifying { + m.form, cmd = m.form.Update(msg) + return m, cmd + } + m.board, cmd = m.board.Update(msg) + return m, cmd +} + +func (m Model) View() string { + if m.modifying { + return m.form.View() + } + return m.board.View() +} + +/* Board Stuff */ + +type EditFormMsg struct { + title string + description string + index int + column column +} + +type NewFormMsg struct { + index int + column column +} + type Board struct { help help.Model loaded bool @@ -25,22 +95,22 @@ func (m *Board) Init() tea.Cmd { return nil } -func (m *Board) Update(msg tea.Msg) (tea.Model, tea.Cmd) { +func (m *Board) Update(msg tea.Msg) (*Board, tea.Cmd) { + var cmd tea.Cmd + var cmds []tea.Cmd switch msg := msg.(type) { case tea.WindowSizeMsg: - var cmd tea.Cmd - var cmds []tea.Cmd m.help.Width = msg.Width - margin - for i := 0; i < len(m.cols); i++ { - var res tea.Model - res, cmd = m.cols[i].Update(msg) - m.cols[i] = res.(column) + for i := range m.cols { + m.cols[i], cmd = m.cols[i].Update(msg) cmds = append(cmds, cmd) } m.loaded = true return m, tea.Batch(cmds...) - case Form: - return m, m.cols[m.focused].Set(msg.index, msg.CreateTask()) + case ReturnBoardMsg: + if !msg.abort { + return m, m.cols[m.focused].Set(msg.form.index, msg.form.CreateTask()) + } case moveMsg: return m, m.cols[m.focused.getNext()].Set(APPEND, msg.Task) case tea.KeyMsg: @@ -58,12 +128,7 @@ func (m *Board) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.cols[m.focused].Focus() } } - res, cmd := m.cols[m.focused].Update(msg) - if _, ok := res.(column); ok { - m.cols[m.focused] = res.(column) - } else { - return res, cmd - } + m.cols[m.focused], cmd = m.cols[m.focused].Update(msg) return m, cmd } From 32ce0de74b20bd5d1ac9d7f5a79550416541ede1 Mon Sep 17 00:00:00 2001 From: bashbunni Date: Tue, 20 May 2025 12:52:17 -0700 Subject: [PATCH 2/7] fix(deps): use valid release version --- go.mod | 14 ++------------ go.sum | 32 ++++---------------------------- 2 files changed, 6 insertions(+), 40 deletions(-) diff --git a/go.mod b/go.mod index a6c57f5..7f2ed23 100644 --- a/go.mod +++ b/go.mod @@ -6,34 +6,24 @@ toolchain go1.24.1 require ( github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1 - github.com/charmbracelet/bubbletea v0.24.2 - github.com/charmbracelet/bubbletea/v2 v2.0.0-beta1 - github.com/charmbracelet/lipgloss/v2 v2.0.0-beta1 + github.com/charmbracelet/bubbletea/v2 v2.0.0-beta.1 + github.com/charmbracelet/lipgloss/v2 v2.0.0-beta.1 ) require ( github.com/atotto/clipboard v0.1.4 // indirect - github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/charmbracelet/colorprofile v0.3.0 // indirect github.com/charmbracelet/x/ansi v0.8.0 // indirect github.com/charmbracelet/x/cellbuf v0.0.13 // indirect github.com/charmbracelet/x/input v0.3.4 // indirect github.com/charmbracelet/x/term v0.2.1 // indirect github.com/charmbracelet/x/windows v0.2.0 // indirect - github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect - github.com/mattn/go-localereader v0.0.1 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect - github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect github.com/muesli/cancelreader v0.2.2 // indirect - github.com/muesli/reflow v0.3.0 // indirect - github.com/muesli/termenv v0.15.1 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/sahilm/fuzzy v0.1.1 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect golang.org/x/sync v0.12.0 // indirect golang.org/x/sys v0.31.0 // indirect - golang.org/x/term v0.9.0 // indirect - golang.org/x/text v0.23.0 // indirect ) diff --git a/go.sum b/go.sum index 2ea6c77..7a2d252 100644 --- a/go.sum +++ b/go.sum @@ -2,20 +2,16 @@ github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE= github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4= github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= -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/charmbracelet/bubbles/v2 v2.0.0-beta.1 h1:swACzss0FjnyPz1enfX56GKkLiuKg5FlyVmOLIlU2kE= github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1/go.mod h1:6HamsBKWqEC/FVHuQMHgQL+knPyvHH55HwJDHl/adMw= -github.com/charmbracelet/bubbletea v0.24.2 h1:uaQIKx9Ai6Gdh5zpTbGiWpytMU+CfsPp06RaW2cx/SY= -github.com/charmbracelet/bubbletea v0.24.2/go.mod h1:XdrNrV4J8GiyshTtx3DNuYkR1FDaJmO3l2nejekbsgg= -github.com/charmbracelet/bubbletea/v2 v2.0.0-beta1 h1:yaxFt97mvofGY7bYZn8U/aSVoamXGE3O4AEvWhshUDI= -github.com/charmbracelet/bubbletea/v2 v2.0.0-beta1/go.mod h1:qbcZLI5z8R49v9xBdU5V5Dh5D2uccx8wSwBqxQyErqc= +github.com/charmbracelet/bubbletea/v2 v2.0.0-beta.1 h1:AOXhvsZa/VZhuBbrUR8GWbYloAkMw2OeHWWgFjKYPA0= +github.com/charmbracelet/bubbletea/v2 v2.0.0-beta.1/go.mod h1:hYsjyXwOT3RiI2CI4WQYPUg4vg2O1TNTpk8TQTavCPI= github.com/charmbracelet/colorprofile v0.3.0 h1:KtLh9uuu1RCt+Hml4s6Hz+kB1PfV3wi++1h5ia65yKQ= github.com/charmbracelet/colorprofile v0.3.0/go.mod h1:oHJ340RS2nmG1zRGPmhJKJ/jf4FPNNk0P39/wBPA1G0= -github.com/charmbracelet/lipgloss/v2 v2.0.0-beta1 h1:SOylT6+BQzPHEjn15TIzawBPVD0QmhKXbcb3jY0ZIKU= -github.com/charmbracelet/lipgloss/v2 v2.0.0-beta1/go.mod h1:tRlx/Hu0lo/j9viunCN2H+Ze6JrmdjQlXUQvvArgaOc= +github.com/charmbracelet/lipgloss/v2 v2.0.0-beta.1 h1:kU4FK3BrF9yfW4P1tT1+Ag9KVckKhkUuLTwj//7SzaA= +github.com/charmbracelet/lipgloss/v2 v2.0.0-beta.1/go.mod h1:tRlx/Hu0lo/j9viunCN2H+Ze6JrmdjQlXUQvvArgaOc= 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= @@ -28,28 +24,14 @@ github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQ github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= 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/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 h1:q2hJAaP1k2wIvVRd/hEHD7lacgqrCPS+k8g1MndzfWY= -github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 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/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= -github.com/mattn/go-isatty v0.0.19/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= -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/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= -github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= -github.com/muesli/termenv v0.15.1 h1:UzuTb/+hhlBugQz28rpzey4ZuKcZ03MeKsoG7IJZIxs= -github.com/muesli/termenv v0.15.1/go.mod h1:HeAQPTzpfs016yGtA4g00CsdYnVLJvxsS4ANqrZs2sQ= -github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= @@ -61,11 +43,5 @@ golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/term v0.9.0 h1:GRRCnKYhdQrD8kfRAdQ6Zcw1P0OcELxGLKJvtjVMZ28= -golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo= -golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= -golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= From 7cacd2c8cd87b2dfd09ef918b082116e2955ed51 Mon Sep 17 00:00:00 2001 From: bashbunni Date: Tue, 20 May 2025 12:54:11 -0700 Subject: [PATCH 3/7] refactor: move board to its own file --- board.go | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ model.go | 90 ------------------------------------------------------ 2 files changed, 92 insertions(+), 90 deletions(-) create mode 100644 board.go diff --git a/board.go b/board.go new file mode 100644 index 0000000..c7e045d --- /dev/null +++ b/board.go @@ -0,0 +1,92 @@ +package main + +import ( + "github.com/charmbracelet/bubbles/v2/help" + "github.com/charmbracelet/bubbles/v2/key" + tea "github.com/charmbracelet/bubbletea/v2" + "github.com/charmbracelet/lipgloss/v2" +) + +type EditFormMsg struct { + title string + description string + index int + column column +} + +type NewFormMsg struct { + index int + column column +} + +type Board struct { + help help.Model + loaded bool + focused status + cols []column + quitting bool +} + +func NewBoard() *Board { + help := help.New() + help.ShowAll = true + return &Board{help: help, focused: todo} +} + +func (m *Board) Init() tea.Cmd { + return nil +} + +func (m *Board) Update(msg tea.Msg) (*Board, tea.Cmd) { + var cmd tea.Cmd + var cmds []tea.Cmd + switch msg := msg.(type) { + case tea.WindowSizeMsg: + m.help.Width = msg.Width - margin + for i := range m.cols { + m.cols[i], cmd = m.cols[i].Update(msg) + cmds = append(cmds, cmd) + } + m.loaded = true + return m, tea.Batch(cmds...) + case ReturnBoardMsg: + if !msg.abort { + return m, m.cols[m.focused].Set(msg.form.index, msg.form.CreateTask()) + } + case moveMsg: + return m, m.cols[m.focused.getNext()].Set(APPEND, msg.Task) + case tea.KeyMsg: + switch { + case key.Matches(msg, keys.Quit): + m.quitting = true + return m, tea.Quit + case key.Matches(msg, keys.Left): + m.cols[m.focused].Blur() + m.focused = m.focused.getPrev() + m.cols[m.focused].Focus() + case key.Matches(msg, keys.Right): + m.cols[m.focused].Blur() + m.focused = m.focused.getNext() + m.cols[m.focused].Focus() + } + } + m.cols[m.focused], cmd = m.cols[m.focused].Update(msg) + return m, cmd +} + +// Changing to pointer receiver to get back to this model after adding a new task via the form... Otherwise I would need to pass this model along to the form and it becomes highly coupled to the other models. +func (m *Board) View() string { + if m.quitting { + return "" + } + if !m.loaded { + return "loading..." + } + board := lipgloss.JoinHorizontal( + lipgloss.Left, + m.cols[todo].View(), + m.cols[inProgress].View(), + m.cols[done].View(), + ) + return lipgloss.JoinVertical(lipgloss.Left, board, m.help.View(keys)) +} diff --git a/model.go b/model.go index c410079..27febea 100644 --- a/model.go +++ b/model.go @@ -1,16 +1,12 @@ package main import ( - "github.com/charmbracelet/bubbles/v2/help" - "github.com/charmbracelet/bubbles/v2/key" tea "github.com/charmbracelet/bubbletea/v2" - "github.com/charmbracelet/lipgloss/v2" ) // TODOs // - clean up textinput & area placeholder text (form could use some razzle dazzle) - use huh for this instead? // - get accurate help menu options (not showing options properly) -// - move board to its own file type Model struct { // false is board, true is form @@ -62,89 +58,3 @@ func (m Model) View() string { } return m.board.View() } - -/* Board Stuff */ - -type EditFormMsg struct { - title string - description string - index int - column column -} - -type NewFormMsg struct { - index int - column column -} - -type Board struct { - help help.Model - loaded bool - focused status - cols []column - quitting bool -} - -func NewBoard() *Board { - help := help.New() - help.ShowAll = true - return &Board{help: help, focused: todo} -} - -func (m *Board) Init() tea.Cmd { - return nil -} - -func (m *Board) Update(msg tea.Msg) (*Board, tea.Cmd) { - var cmd tea.Cmd - var cmds []tea.Cmd - switch msg := msg.(type) { - case tea.WindowSizeMsg: - m.help.Width = msg.Width - margin - for i := range m.cols { - m.cols[i], cmd = m.cols[i].Update(msg) - cmds = append(cmds, cmd) - } - m.loaded = true - return m, tea.Batch(cmds...) - case ReturnBoardMsg: - if !msg.abort { - return m, m.cols[m.focused].Set(msg.form.index, msg.form.CreateTask()) - } - case moveMsg: - return m, m.cols[m.focused.getNext()].Set(APPEND, msg.Task) - case tea.KeyMsg: - switch { - case key.Matches(msg, keys.Quit): - m.quitting = true - return m, tea.Quit - case key.Matches(msg, keys.Left): - m.cols[m.focused].Blur() - m.focused = m.focused.getPrev() - m.cols[m.focused].Focus() - case key.Matches(msg, keys.Right): - m.cols[m.focused].Blur() - m.focused = m.focused.getNext() - m.cols[m.focused].Focus() - } - } - m.cols[m.focused], cmd = m.cols[m.focused].Update(msg) - return m, cmd -} - -// Changing to pointer receiver to get back to this model after adding a new task via the form... Otherwise I would need to pass this model along to the form and it becomes highly coupled to the other models. -func (m *Board) View() string { - if m.quitting { - return "" - } - if !m.loaded { - return "loading..." - } - board := lipgloss.JoinHorizontal( - lipgloss.Left, - m.cols[todo].View(), - m.cols[inProgress].View(), - m.cols[done].View(), - ) - return lipgloss.JoinVertical(lipgloss.Left, board, m.help.View(keys)) -} From 0c25a1c878ef5b090bce35742c49d30f69e91898 Mon Sep 17 00:00:00 2001 From: bashbunni Date: Tue, 20 May 2025 12:54:50 -0700 Subject: [PATCH 4/7] fix(form): show complete placeholder text --- form.go | 2 ++ main.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/form.go b/form.go index cbe1739..b237706 100644 --- a/form.go +++ b/form.go @@ -32,6 +32,8 @@ func NewForm(title, description string) Form { title: textinput.New(), description: textarea.New(), } + form.title.SetWidth(defaultWidth) + form.description.SetWidth(defaultWidth) form.title.Placeholder = title form.description.Placeholder = description form.title.Focus() diff --git a/main.go b/main.go index 2ca85a1..d764b7b 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,8 @@ import ( tea "github.com/charmbracelet/bubbletea/v2" ) +const defaultWidth int = 80 + type status int func (s status) getNext() status { From 1cdddc4471bf7f91d6ea62c12044edeb31e211ac Mon Sep 17 00:00:00 2001 From: bashbunni Date: Tue, 20 May 2025 13:06:40 -0700 Subject: [PATCH 5/7] fix(help): show all help options --- keys.go | 15 ++++++++------- model.go | 2 -- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/keys.go b/keys.go index 06108f6..393fcfd 100644 --- a/keys.go +++ b/keys.go @@ -5,15 +5,16 @@ import "github.com/charmbracelet/bubbles/v2/key" // ShortHelp returns keybindings to be shown in the mini help view. It's part // of the key.Map interface. func (k keyMap) ShortHelp() []key.Binding { - return []key.Binding{k.Help, k.Quit} + return []key.Binding{k.New, k.Edit, k.Delete, k.Help, k.Quit} } // FullHelp returns keybindings for the expanded help view. It's part of the // key.Map interface. func (k keyMap) FullHelp() [][]key.Binding { return [][]key.Binding{ - {k.Up, k.Down, k.Left, k.Right}, // first column - {k.Help, k.Quit}, // second column + {k.New, k.Edit, k.Delete, k.Enter}, + {k.Up, k.Down, k.Left, k.Right}, + {k.Back, k.Quit}, } } @@ -34,15 +35,15 @@ type keyMap struct { var keys = keyMap{ New: key.NewBinding( key.WithKeys("n"), - key.WithHelp("n", "new"), + key.WithHelp("n", "new item"), ), Edit: key.NewBinding( key.WithKeys("e"), - key.WithHelp("e", "edit"), + key.WithHelp("e", "edit item"), ), Delete: key.NewBinding( key.WithKeys("d"), - key.WithHelp("d", "delete"), + key.WithHelp("d", "delete item"), ), Up: key.NewBinding( key.WithKeys("up", "k"), @@ -62,7 +63,7 @@ var keys = keyMap{ ), Enter: key.NewBinding( key.WithKeys("enter"), - key.WithHelp("enter", "enter"), + key.WithHelp("enter", "move item"), ), Help: key.NewBinding( key.WithKeys("?"), diff --git a/model.go b/model.go index 27febea..dfb74bd 100644 --- a/model.go +++ b/model.go @@ -5,7 +5,6 @@ import ( ) // TODOs -// - clean up textinput & area placeholder text (form could use some razzle dazzle) - use huh for this instead? // - get accurate help menu options (not showing options properly) type Model struct { @@ -41,7 +40,6 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.form = NewForm(msg.title, msg.description) m.form.index = msg.index m.form.col = msg.column - // need to trigger what used to happen when a Form was received as msg. } if m.modifying { From be274095e8873d499479fe96af797c5f5cb74d04 Mon Sep 17 00:00:00 2001 From: bashbunni Date: Wed, 21 May 2025 11:29:06 -0700 Subject: [PATCH 6/7] chore: remove TODO comments --- model.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/model.go b/model.go index dfb74bd..2cba570 100644 --- a/model.go +++ b/model.go @@ -4,9 +4,6 @@ import ( tea "github.com/charmbracelet/bubbletea/v2" ) -// TODOs -// - get accurate help menu options (not showing options properly) - type Model struct { // false is board, true is form modifying bool From 39916f0a0e4ef16a088de41a8ade2d20b0b8765d Mon Sep 17 00:00:00 2001 From: bashbunni Date: Wed, 4 Jun 2025 12:38:29 -0700 Subject: [PATCH 7/7] fix(deps): clean up go.sum with go mod download --- go.sum | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/go.sum b/go.sum index 7a2d252..d8a857c 100644 --- a/go.sum +++ b/go.sum @@ -1,47 +1,19 @@ -github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ= -github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE= -github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4= github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= -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/charmbracelet/bubbles/v2 v2.0.0-beta.1 h1:swACzss0FjnyPz1enfX56GKkLiuKg5FlyVmOLIlU2kE= github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1/go.mod h1:6HamsBKWqEC/FVHuQMHgQL+knPyvHH55HwJDHl/adMw= -github.com/charmbracelet/bubbletea/v2 v2.0.0-beta.1 h1:AOXhvsZa/VZhuBbrUR8GWbYloAkMw2OeHWWgFjKYPA0= -github.com/charmbracelet/bubbletea/v2 v2.0.0-beta.1/go.mod h1:hYsjyXwOT3RiI2CI4WQYPUg4vg2O1TNTpk8TQTavCPI= -github.com/charmbracelet/colorprofile v0.3.0 h1:KtLh9uuu1RCt+Hml4s6Hz+kB1PfV3wi++1h5ia65yKQ= +github.com/charmbracelet/bubbletea/v2 v2.0.0-beta.1/go.mod h1:qbcZLI5z8R49v9xBdU5V5Dh5D2uccx8wSwBqxQyErqc= github.com/charmbracelet/colorprofile v0.3.0/go.mod h1:oHJ340RS2nmG1zRGPmhJKJ/jf4FPNNk0P39/wBPA1G0= -github.com/charmbracelet/lipgloss/v2 v2.0.0-beta.1 h1:kU4FK3BrF9yfW4P1tT1+Ag9KVckKhkUuLTwj//7SzaA= github.com/charmbracelet/lipgloss/v2 v2.0.0-beta.1/go.mod h1:tRlx/Hu0lo/j9viunCN2H+Ze6JrmdjQlXUQvvArgaOc= -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/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/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/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -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/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/sahilm/fuzzy v0.1.1 h1:ceu5RHF8DGgoi+/dR5PsECjCDH1BE3Fnmpo7aVXOdRA= github.com/sahilm/fuzzy v0.1.1/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y= -github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= -golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= -golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=