Documentation
¶
Overview ¶
Package rawmode provides a minimal set of functions to enter and exit raw input mode. Entering raw mode requires a system call which is OS specific. This package collects all these syscall functions.
The implementation has been largely inspired by golang.org/x/term but has been simplified as well as adopted for the specific needs and direction of this module.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsTerminal ¶
IsTerminal returns true, iff fd references an input channel connected to a terminal.
Types ¶
type State ¶
type State struct {
// contains filtered or unexported fields
}
State represents an opaque value describing the OS specific state a terminal was in when entering raw mode. It can only be used to be restored which means leaving raw mode.
func Enter ¶
Enter enters raw input mode for the input file descriptor fd. This is usually os.Stdin.Fd() but may be selected differently for specific applications. Enter performs the required system calls and returns an opaque State which describes the terminal state before entering raw mode. Restoring that state later means to exit raw mode and return to canonical mode. In case the operation fails a non-nil error is returned and State is undefined.