tui

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package tui implements Rune's interactive task picker (the `--choose` experience) as a Bubble Tea program. It is a pure presentation layer: it renders a filterable list of tasks and reports the user's selection, but it never loads a Runefile or executes a task. The caller (internal/cli) projects tasks into PickerItem values, runs the program, and delegates the selected task name to the existing execution path. Keeping execution out of this package preserves Rune's locked engine layout and keeps Update a pure, table-testable function of (Model, Msg).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model is the picker state. Update is a pure function of (Model, Msg): it changes only the returned Model and emits commands, never touching I/O.

func New

func New(items []PickerItem, color bool) Model

New builds a picker over items. color toggles styling (FR-015/FR-021).

func (Model) Init

func (m Model) Init() tea.Cmd

Init implements tea.Model.

func (Model) Selected

func (m Model) Selected() string

Selected returns the chosen task name, or "" if the user cancelled.

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model.

func (Model) View

func (m Model) View() string

View implements tea.Model.

type PickerItem

type PickerItem struct {
	Name string // task name; what gets executed on selection
	Desc string // one-line description (first line of the task doc)
	Doc  string // full documentation, shown in the detail pane
}

PickerItem is one selectable task row, projected from an ast.Task by the caller. It implements bubbles/list.Item (FilterValue) and list.DefaultItem (Title, Description) so the default delegate can render it.

func (PickerItem) Description

func (i PickerItem) Description() string

Description is the secondary label shown under the title.

func (PickerItem) FilterValue

func (i PickerItem) FilterValue() string

FilterValue spans both the name and the description so incremental filtering matches either (FR-003).

func (PickerItem) Title

func (i PickerItem) Title() string

Title is the primary label shown in the list (the task name).

type Styles

type Styles struct {
	Title  lipgloss.Style // list title
	Detail lipgloss.Style // detail pane body
	Help   lipgloss.Style // key hint line
}

Styles holds the Lip Gloss styles for the picker. When color is disabled (NO_COLOR or a non-color terminal), every style is the zero (plain) style so the picker renders without ANSI escapes while staying fully usable (FR-015).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL