tui

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package tui provides the interactive Bubbletea TUI for template selection and meme generation.

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 bubbletea model for the template picker TUI.

func NewPicker

func NewPicker(items []list.Item) Model

NewPicker creates a new picker Model with the given list items.

func (Model) Cancelled

func (m Model) Cancelled() bool

Cancelled returns true if the user cancelled the picker.

func (Model) Init

func (m Model) Init() tea.Cmd

Init returns the initial command. The list handles its own init internally.

func (Model) Selected

func (m Model) Selected() *api.Template

Selected returns the selected template, or nil if none selected.

func (Model) State

func (m Model) State() State

State returns the current picker state.

func (Model) Texts

func (m Model) Texts() []string

Texts returns the collected text input values after confirmation.

func (Model) Update

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

Update handles messages and updates model state.

func (Model) View

func (m Model) View() string

View renders the current TUI state.

type State

type State int

State represents the current phase of the TUI model.

const (
	// StatePicking is the fuzzy template picker phase.
	StatePicking State = iota
	// StateInputting is the text input phase (used by plan 02).
	StateInputting
	// StateDone means the TUI is finished and ready to quit.
	StateDone
)

type TemplateItem

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

TemplateItem wraps api.Template to implement the bubbles list.DefaultItem interface. It provides Title, Description, and FilterValue for the fuzzy picker list component.

func NewTemplateItem

func NewTemplateItem(t api.Template) TemplateItem

NewTemplateItem creates a TemplateItem from an api.Template.

func (TemplateItem) Description

func (i TemplateItem) Description() string

Description returns template ID and line count for list display.

func (TemplateItem) FilterValue

func (i TemplateItem) FilterValue() string

FilterValue returns a combined string of name, ID, and keywords for fuzzy matching.

func (TemplateItem) Template

func (i TemplateItem) Template() api.Template

Template returns the wrapped api.Template.

func (TemplateItem) Title

func (i TemplateItem) Title() string

Title returns the template name for list display.

Jump to

Keyboard shortcuts

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