This commit is contained in:
june 2025-03-09 10:06:40 +13:00
parent db8e66666c
commit 074cb059eb
Signed by untrusted user who does not match committer: breadone
GPG Key ID: FDC19FE143200483
2 changed files with 70 additions and 60 deletions

View File

@ -1,7 +1,8 @@
package main package main
import( import (
"fmt" "fmt"
tea "github.com/charmbracelet/bubbletea" tea "github.com/charmbracelet/bubbletea"
) )
@ -70,7 +71,7 @@ func (m model) View() string {
switch m.tab { switch m.tab {
case 0: case 0:
s += "Inbox" s += "Inbox"
inboxFilter := func(t todo) bool { return t.isInbox} inboxFilter := func(t todo) bool { return t.isInbox }
currentList = filter(m.todos, inboxFilter) currentList = filter(m.todos, inboxFilter)
case 1: case 1:
s += "Today" s += "Today"
@ -84,7 +85,6 @@ func (m model) View() string {
s += "\n\n" s += "\n\n"
// Iterate over our choices // Iterate over our choices
for i, choice := range currentList { for i, choice := range currentList {

10
helper.go Normal file
View File

@ -0,0 +1,10 @@
package main
func filter[T any](ss []T, test func(T) bool) (ret []T) {
for _, s := range ss {
if test(s) {
ret = append(ret, s)
}
}
return
}