No description
- Go 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| go.mod | ||
| go.sum | ||
| input.go | ||
| main.go | ||
| readme.md | ||
| tasklist.go | ||
todo-cli
A terminal todo list built with Charm's Bubble Tea v2 — a small, dependency-light playground for learning the Elm-architecture TUI pattern (Model, Update, View).
Usage
go run .
Tasks
> [ ] Plant a Tree
New Task▌
Press Ctrl+C to quit.
Keys
| Key | Action |
|---|---|
up / k |
Move selection up |
down / j |
Move selection down (wraps into a new-task input at the end) |
n |
Open the new-task input |
space / x |
Toggle done on the selected task |
d |
Delete the selected task |
enter |
Submit the task input |
esc |
Close the task input |
ctrl+c |
Quit |
How it works
Three Bubble Tea components, one per file:
main.go— the rootmodel. It composes the children, forwards messages to them inUpdate, and assembles the full screen inView. All child commands are collected and run withtea.Batch. The cursor position is placed over the input by measuring the height of everything rendered above it (lipgloss.Height+JoinVertical), so the cursor never drifts from the layout.tasklist.go—TaskList: renders items with a>cursor marker and[x]checkboxes, and emitsNewTaskMsgwhen the user navigates past the last item.input.go—TaskInput: wrapsbubbles/v2/textinput. It only handles keypresses while focused, emitsTaskSubmitMsgonenter, and exposes a*tea.Cursorthat isnilwhen blurred so the terminal cursor only shows on the input.
Message flow between components:
TaskList --NewTaskMsg--> model.Focus() input --> user types --> TaskSubmitMsg --> model adds task + blurs input
\--> TaskCancelMsg --> model closes input