Documentation
¶
Overview ¶
Package tui implements CleanX's Bubble Tea terminal UI, replacing the raw ANSI escape sequences of the reference script with a proper full-screen, terminal-agnostic interface. It drives the whole interactive flow:
settings → scan (spinner) → multi-select (checkboxes, sizes, drill-down)
→ confirm (destructive) → run (progress bar) → summary (+ Time
Machine snapshots)
All side effects — scanning, deleting, running tool cleanups, Time Machine — are injected via Actions, so the model's state transitions are decoupled from the OS and the pure selection/toggle logic is unit-tested.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Actions ¶
type Actions struct {
Scan func(scan.Options) scan.Result
ToolCleanups func() []toolclean.Cleanup
DeletePaths func(paths []string) cleaner.Result
RunTool func(c toolclean.Cleanup) (freedKB int64, err error)
ListSnaps func() []string
DeleteSnap func(id string) error
}
Actions injects the effectful operations the UI performs. Wiring lives in cmd; tests supply fakes.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the Bubble Tea model.
func New ¶
New builds the initial model. When skipSettings is true the model starts scanning immediately (used by the --run/--dry-run flags), otherwise it opens on the settings screen.
func (Model) Init ¶
Init implements tea.Model. When the model was constructed to skip settings it kicks off the scan (and spinner) immediately.
func (Model) Quitting ¶
Quitting reports whether the user ended the session (used by cmd to know the program exited normally).