tui

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package tui implements the optional Bubble Tea terminal UI for sendit start.

It is activated with --tui on a TTY. When stdout is not a terminal the flag is silently ignored and plain zerolog output continues unchanged.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, state *State, cfg *config.Config) error

Run starts the Bubble Tea program and blocks until the user quits (q / ctrl-c) or ctx is cancelled (SIGINT / --duration timeout). When ctx is cancelled the program is asked to quit and Run returns nil.

Types

type Snapshot

type Snapshot struct {
	Total     int64
	Success   int64
	Errors    int64
	Elapsed   time.Duration
	Latencies []time.Duration // last ≤128 successful durations, oldest first
}

Snapshot is a consistent point-in-time read of the State.

func (Snapshot) Avg

func (sn Snapshot) Avg() time.Duration

Avg returns the mean latency across Latencies, or 0 if empty.

func (Snapshot) P95

func (sn Snapshot) P95() time.Duration

P95 returns the 95th-percentile latency, or 0 if fewer than 2 samples.

type State

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

State is the shared counter store written by engine dispatch goroutines and read by the TUI render tick. All methods are safe for concurrent use.

func NewState

func NewState() *State

NewState returns an initialised State with the clock started at now.

func (*State) Record

func (s *State) Record(r task.Result)

Record is the engine observer callback; safe for concurrent use from many dispatch goroutines.

func (*State) Snapshot

func (s *State) Snapshot() Snapshot

Snapshot returns a consistent read of the current state.

Jump to

Keyboard shortcuts

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