tui

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 6 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(sections []PickerSection, color bool) Model

New builds a picker over sections. color toggles styling (FR-015/FR-021). Sections are flattened into a single, section-tagged item list; when no section carries a name the picker renders as a plain flat list, byte- identical to before grouping existed (FR-004).

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
	Section string // group name this task belongs to; "" if ungrouped
}

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 PickerSection added in v0.4.0

type PickerSection struct {
	Name  string
	Items []PickerItem
}

PickerSection groups a set of tasks under a shared label for New. Name is the group("...") attribute's value, or "" for the ungrouped section; it is never rendered as a header of its own (see sectionDelegate).

type Styles

type Styles struct {
	Title  lipgloss.Style // list title
	Detail lipgloss.Style // detail pane body
	Help   lipgloss.Style // key hint line
	Header lipgloss.Style // section header line, drawn above a section's first item
}

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