termui

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

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

Block is a pinned, fixed-height live region on the alternate screen. It owns all pterm usage, its mutex, the spinner ticker and the resize watcher. All exported methods are safe for concurrent use.

func New

func New(w io.Writer, opts Options) *Block

func (*Block) Finish

func (b *Block) Finish()

Finish ends the live UI: leaves the alt screen and prints the closing summary.

func (*Block) Log

func (b *Block) Log(line string)

func (*Block) Milestone

func (b *Block) Milestone(prefix, status, text string)

Milestone takes the box prefix of the process block the line came from, on the same terms as Warn: it is applied only when the line is printed inline, and dropped for the pinned milestone region and the closing summary, which render milestones detached from any block.

func (*Block) Pause

func (b *Block) Pause()

func (*Block) Restore

func (b *Block) Restore()

Restore is the safety teardown (signal/panic/early error exit). Like Finish it leaves the alt screen and prints the closing summary, so a fatal error — which never reaches Finish — is still surfaced on the main screen instead of vanishing with the alt buffer. Safe to call multiple times and after Finish.

func (*Block) Resume

func (b *Block) Resume()

func (*Block) SetAction

func (b *Block) SetAction(text string)

func (*Block) SetBanner

func (b *Block) SetBanner(lines []string)

SetBanner stores the startup ASCII banner lines and triggers a repaint. The banner is shown only when the terminal is tall enough that showing it still leaves room for the full live region — it is the first thing dropped under degradation.

func (*Block) SetConnString

func (b *Block) SetConnString(s string)

SetConnString stores the SSH connection string and triggers a repaint. The string is rendered as a pinned cyan line just above the logbox and is never scrolled away by milestones. It is also included in the closing summary dump.

func (*Block) SetProgress

func (b *Block) SetProgress(frac float64, title string)

func (*Block) Start

func (b *Block) Start(title string)

func (*Block) Warn

func (b *Block) Warn(prefix, line string)

Warn takes the box prefix of the process block the line came from (empty at top level). The prefix is applied only on the paths that print the line inline, interleaved with that block's other lines - during a pause, before the block is active, and after the closing dump - where dropping it would tear the ┌/│/└ frame. The pinned warn region and the closing summary render warnings detached from any block, so there the prefix is dropped: it would draw a frame edge next to a frame that is not on screen.

type Options

type Options struct {
	Color  bool
	Banner []string
	Caps   caps
	// contains filtered or unexported fields
}

Options configures a Block. The unexported fields are injection points for tests; production code leaves them nil and New fills defaults.

Jump to

Keyboard shortcuts

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