No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-23 16:04:19 +03:00
go.mod init 2026-10-23 16:04:19 +03:00
go.sum init 2026-10-23 16:04:19 +03:00
input.go init 2026-10-23 16:04:19 +03:00
main.go init 2026-10-23 16:04:19 +03:00
readme.md init 2026-10-23 16:04:19 +03:00
tasklist.go init 2026-10-23 16:04:19 +03:00

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 root model. It composes the children, forwards messages to them in Update, and assembles the full screen in View. All child commands are collected and run with tea.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 emits NewTaskMsg when the user navigates past the last item.
  • input.go — TaskInput: wraps bubbles/v2/textinput. It only handles keypresses while focused, emits TaskSubmitMsg on enter, and exposes a *tea.Cursor that is nil when 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