termui

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

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(status, text string)

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(line string)

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