Documentation
¶
Index ¶
- Variables
- func DisableEcho(fd uintptr, state *State) error
- func GetFdInfo(in interface{}) (fd uintptr, isTerminal bool)
- func IsTerminal(fd uintptr) bool
- func RestoreTerminal(fd uintptr, state *State) error
- func SetWinsize(fd uintptr, ws *Winsize) error
- func StdStreams() (stdIn io.ReadCloser, stdOut, stdErr io.Writer)
- type State
- type Termiosdeprecated
- type Winsize
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidState = errors.New("Invalid terminal state")
ErrInvalidState is returned if the state of the terminal is invalid.
Deprecated: ErrInvalidState is no longer used.
Functions ¶
func DisableEcho ¶
DisableEcho applies the specified state to the terminal connected to the file descriptor, with echo disabled.
func GetFdInfo ¶
GetFdInfo returns the file descriptor for an os.File and indicates whether the file represents a terminal.
func IsTerminal ¶
IsTerminal returns true if the given file descriptor is a terminal.
func RestoreTerminal ¶
RestoreTerminal restores the terminal connected to the given file descriptor to a previous state.
func SetWinsize ¶
SetWinsize tries to set the specified window size for the specified file descriptor. It is only implemented on Unix, and returns an error on Windows.
func StdStreams ¶
func StdStreams() (stdIn io.ReadCloser, stdOut, stdErr io.Writer)
StdStreams returns the standard streams (stdin, stdout, stderr).
On Windows, it attempts to turn on VT handling on all std handles if supported, or falls back to terminal emulation. On Unix, this returns the standard os.Stdin, os.Stdout and os.Stderr.
Types ¶
type State ¶
type State terminalState
State holds the platform-specific state / console mode for the terminal.
func MakeRaw ¶
MakeRaw puts the terminal (Windows Console) connected to the given file descriptor into raw mode and returns the previous state of the terminal so that it can be restored.
func SetRawTerminal ¶
SetRawTerminal puts the terminal connected to the given file descriptor into raw mode and returns the previous state. On UNIX, this is the equivalent of MakeRaw, and puts both the input and output into raw mode. On Windows, it only puts the input into raw mode.
func SetRawTerminalOutput ¶
SetRawTerminalOutput puts the output of terminal connected to the given file descriptor into raw mode. On UNIX, this does nothing and returns nil for the state. On Windows, it disables LF -> CRLF translation.