term

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2022 License: Apache-2.0 Imports: 8 Imported by: 28

README

Go 1.18+ Terminal Escapes, Color, Size

Go Version GoDoc License Go Report Card

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Reset      string
	Bright     string
	Bold       string
	Dim        string
	Italic     string
	Under      string
	Blink      string
	BlinkF     string
	Reverse    string
	Hidden     string
	Strike     string
	BoldItalic string
	Black      string
	Red        string
	Green      string
	Yellow     string
	Blue       string
	Magenta    string
	Cyan       string
	White      string
	BBlack     string
	BRed       string
	BGreen     string
	BYellow    string
	BBlue      string
	BMagenta   string
	BCyan      string
	BWhite     string
	HBlack     string
	HRed       string
	HGreen     string
	HYellow    string
	HBlue      string
	HMagenta   string
	HCyan      string
	HWhite     string
	BHBlack    string
	BHRed      string
	BHGreen    string
	BHYellow   string
	BHBlue     string
	BHMagenta  string
	BHCyan     string
	BHWhite    string
	X          string
	B          string
	I          string
	U          string
	BI         string
)

Functions

func AttrOff

func AttrOff()

AttrOff sets all the terminal attributes to zero values (empty strings). Note that this does not affect anything in the esc subpackage (which contains the constants from the VT100 specification).

func AttrOn

func AttrOn()

AttrOn sets all the terminal attributes to zero values (empty strings). Note that this does not affect anything in the esc subpackage (which contains the constants from the VT100 specification).

func IsInteractive

func IsInteractive() bool

IsInteractive returns true if the output is to an interactive terminal (not piped in any way). This is useful when determining if an extra line return is needed to avoid making programs chomp the line returns unnecessarily.

func Read added in v0.1.1

func Read() string

Read reads a single line of input and chomps the \r?\n. Also see ReadHidden.

func ReadHidden added in v0.1.1

func ReadHidden() string

ReadHidden disables the cursor and echoing to the screen and reads a single line of input. Leading and trailing whitespace are removed. Also see Read.

func WinSizeUpdate

func WinSizeUpdate()

Types

type WinSizeStruct

type WinSizeStruct struct {
	Row, Col       uint16
	Xpixel, Ypixel uint16
}

WinSizeStruct is the exact struct used by the ioctl system library.

var WinSize WinSizeStruct

WinSize is 80x24 by default but is detected and set to a more accurate value at init() time on systems that support ioctl (currently) and can be updated with WinSizeUpdate on systems that support it. This value can be overriden by those wishing a more consistent value or who prefer not to fill the screen completely when displaying help and usage information.

Directories

Path Synopsis
cmd
term command
Package esc contains commonly used VT100 ANSI terminal escape sequences for different attributes and terminal control.
Package esc contains commonly used VT100 ANSI terminal escape sequences for different attributes and terminal control.

Jump to

Keyboard shortcuts

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