Documentation
¶
Overview ¶
Package terminfo implements reading terminfo files in pure go.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrSmallFile = errors.New("terminfo: file too small") ErrBadString = errors.New("terminfo: bad string") ErrBigSection = errors.New("terminfo: section too big") ErrBadHeader = errors.New("terminfo: bad header") )
These are the decoding errors.
var ErrEmptyTerm = errors.New("terminfo: empty term name")
Returned when no name is provided to Load.
Functions ¶
Types ¶
type Terminfo ¶
type Terminfo struct {
Names []string
Bools [caps.BoolCount]bool
Numbers [caps.NumberCount]int16
Strings [caps.StringCount]string
ExtBools map[string]bool
ExtNumbers map[string]int16
ExtStrings map[string]string
}
Terminfo describes a terminal's capabilities.
func Load ¶
Load follows the behavior described in terminfo(5) to find correct the terminfo file using the name, reads the file and then returns a Terminfo struct that describes the file.
func (*Terminfo) Color ¶
Color takes a foreground and background color and returns string that sets them for this terminal. TODO redo with styles integer
func (*Terminfo) Goto ¶
Goto returns a string suitable for addressing the cursor at the given row and column. The origin 0, 0 is in the upper left corner of the screen.
func (*Terminfo) Parm ¶
Parm calls the function Parm with the string in ti.Strings at i and the variadic arguments.
func (*Terminfo) Puts ¶
Puts emits the string to the writer, but expands inline padding indications (of the form $<[delay]> where [delay] is msec) to a suitable number of padding characters (usually null bytes) based upon the supplied baud. At high baud rates, more padding characters will be inserted.