terminal

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package terminal provides terminal-related utilities.

Index

Constants

View Source
const DefaultWidth = 50

DefaultWidth is the default terminal width when detection fails.

Variables

View Source
var GetSize = term.GetSize

GetSize returns the terminal width and height for the given file descriptor. This is a variable to allow mocking in tests.

IsTTY checks if the file descriptor is a TTY. This is a variable to allow mocking in tests.

Functions

func GetWidthFromWriter

func GetWidthFromWriter(w io.Writer) int

GetWidthFromWriter returns the terminal width for the given writer. Returns DefaultWidth if detection fails or writer is not a terminal.

func IsTerminalWriter

func IsTerminalWriter(w io.Writer) bool

IsTerminalWriter returns true if the given writer is a terminal.

Types

type Fder

type Fder interface {
	Fd() uintptr
}

Fder is an interface for types that have a file descriptor.

Jump to

Keyboard shortcuts

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