Documentation
¶
Overview ¶
Package terminal contains helpers for working with Unix-like terminals.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Caps ¶
type Caps struct {
SupportsCursor bool // supports CursorUp and CursorDown control characters
}
Caps are capabilities of the terminal.
func Enable ¶
Enable switches the console attached to the given file (if any) into a terminal mode and returns its capabilities.
Returns (nil, nil) if the given file is not associated with a terminal or it can't be switched into a terminal mode.
On success returns a function that must be called once all terminal interactions are done.
On Unix, this just checks the file is associated with a terminal and fetches some properties of this terminal. On Windows, it actually switches the console into a virtual terminal mode. The returned completion callback will switch it back into its original mode.