terminal

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 11 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearLine

func ClearLine()

ClearLine clears the previous line of the terminal

func EnterAltScreen added in v0.10.0

func EnterAltScreen()

EnterAltScreen switches to the alternate screen buffer. This preserves the main terminal content which can be restored by calling ExitAltScreen.

func ExitAltScreen added in v0.10.0

func ExitAltScreen()

ExitAltScreen switches back to the main screen buffer, restoring the previous terminal content.

func NewVerboseWriter

func NewVerboseWriter(lineHeight int) io.WriteCloser

NewVerboseWriter creates a new verbose writer. A verbose writer pipes the input received to the stdout while tailing the specified lines. Calling `Close` when done is recommended to clear the last uncleared output.

func WithAltScreen added in v0.10.0

func WithAltScreen(fn func() error, header ...string) error

WithAltScreen runs the provided function in the alternate screen buffer. The main terminal content is preserved and restored after the function completes. Handles Ctrl-C to ensure the terminal is restored even on interrupt.

If header lines are provided, they are joined with newlines and displayed as a fixed header at the top of the screen. The command output scrolls below the header. The number of header lines is computed automatically based on newlines and terminal width.

Types

This section is empty.

Jump to

Keyboard shortcuts

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