This commit is contained in:
tiff 2025-05-01 13:02:23 -04:00
parent c31be0e16d
commit 2234f9d7e4

View File

@ -5,16 +5,39 @@ package cmd
import ( import (
"fmt" "fmt"
"os"
"os/signal"
"github.com/charmbracelet/bubbles/table"
tea "github.com/charmbracelet/bubbletea" tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"context"
"database/sql"
"flag"
"log"
"time"
) )
var baseStyle = lipglodd.NewStyle().
BorderStyle(lipgloss.NormalBorder()).
BorderForeground(lipgloss.Color("240"))
// Think of this `struct` as a JavaScript object or Python dictionary
type model struct { type model struct {
// methods? Probably not
todos []string // items on the to-do list todos []string // items on the to-do list
cursor int // which to-do list item our cursor is pointing at cursor int // which to-do list item our cursor is pointing at
// so it looks like Go doesn't have `_self` or `this`?
selected map[int]struct{} // which to-do items are selected selected map[int]struct{} // which to-do items are selected
table table.Model
} }
func (m model) Init() tea.Cmd { return nil }
func initialModel() model { func initialModel() model {
return model{ return model{
// Our to-do list is a grocery list // Our to-do list is a grocery list