tui

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package tui drives the transient interactive terminal view for long-running sdd commands. It imports bubble tea and depends on the bubble-tea-free core in internal/cliout; only cmd/sdd imports this package. Interactive is the reusable entry point: it installs the log pipe for the duration of an operation, runs the work on its own goroutine while a bubble tea program renders progress and a scrolling log tail, and tears the view down on completion so only the result reaches stdout — realizing the per-command terminal experience the architecture directive (d-cpt-mvb) defers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Interactive

func Interactive[T any](ctx context.Context, policy cliout.Policy, view View, work func(context.Context) (T, error)) (T, error)

Interactive runs work under a transient terminal view governed by policy, returning work's result. It is the single reusable coordinator for any long-running command — index, search lazy-fill, and future bulk operations.

Types

type View

type View struct {
	// Label is the operation name shown beside the spinner, e.g. "indexing".
	Label string
	// Progress, when set, drives a determinate bar; nil shows the spinner
	// alone. The caller advances it from the work goroutine via absolute
	// counts (SetTotal/Add).
	Progress *cliout.Reporter
	// StreamLogs, when true, emits display-eligible log entries as durable
	// lines above the footer (they scroll into terminal history) — the
	// "indexing logs persist" case. When false the live view is footer-only
	// and logs stay hidden, surfaced only by the teardown re-emit on a
	// warning/error — the "search indexing is transient" case.
	StreamLogs bool
}

View configures the transient display for one operation.

Jump to

Keyboard shortcuts

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