tui

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package tui provides an offline terminal UI for browsing local corpus data.

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 TUI state.

func New

func New(ctx context.Context, reader tuicontract.Reader, opts ...Option) Model

New creates a Model for the given reader and lifecycle context.

func Run

func Run(ctx context.Context, reader tuicontract.Reader, input io.Reader, output io.Writer) (Model, error)

Run starts the TUI program with the provided local reader and I/O.

It is suitable for later CLI wiring: the caller supplies a context, a Reader, and input/output streams. The TUI loads local data on start and never performs network I/O on its own.

func (Model) Init

func (m Model) Init() tea.Cmd

Init triggers an asynchronous local load. No network I/O is performed here.

func (Model) String

func (m Model) String() string

String returns a short human-readable identifier for the current selection.

func (Model) Update

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

Update processes messages and returns the updated model and any commands.

func (Model) View

func (m Model) View() string

View renders the current model state.

type Option

type Option func(*Model)

Option customizes a Model.

func WithActionHandler

func WithActionHandler(fn func(context.Context, tuicontract.Item) tea.Cmd) Option

WithActionHandler registers an optional handler for explicit side-effecting actions such as refresh/hydration. The TUI never invokes it on initial load or search.

func WithSize

func WithSize(w, h int) Option

WithSize sets the initial terminal size.

type Runner

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

Runner implements the product-owned TUI runner contract.

func NewRunner

func NewRunner(reader tuicontract.Reader, input io.Reader, output io.Writer) *Runner

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, opts contracts.TUIOptions) error

Jump to

Keyboard shortcuts

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