package term
import "github.com/docker/docker/pkg/term"
Package term provides provides structures and helper functions to work with terminal (state, sizes).
Index ¶
- Variables
- func DisableEcho(fd uintptr, state *State) error
- func GetFdInfo(in interface{}) (uintptr, 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)
- func ToBytes(keys string) ([]byte, error)
- type State
- type Winsize
Variables ¶
var ASCII = []string{ "ctrl-@", "ctrl-a", "ctrl-b", "ctrl-c", "ctrl-d", "ctrl-e", "ctrl-f", "ctrl-g", "ctrl-h", "ctrl-i", "ctrl-j", "ctrl-k", "ctrl-l", "ctrl-m", "ctrl-n", "ctrl-o", "ctrl-p", "ctrl-q", "ctrl-r", "ctrl-s", "ctrl-t", "ctrl-u", "ctrl-v", "ctrl-w", "ctrl-x", "ctrl-y", "ctrl-z", "ctrl-[", "ctrl-\\", "ctrl-]", "ctrl-^", "ctrl-_", }
ASCII list the possible supported ASCII key sequence
var ( // ErrInvalidState is returned if the state of the terminal is invalid. ErrInvalidState = errors.New("Invalid terminal state") )
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.
func StdStreams ¶
func StdStreams() (stdIn io.ReadCloser, stdOut, stdErr io.Writer)
StdStreams returns the standard streams (stdin, stdout, stedrr).
func ToBytes ¶
ToBytes converts a string representing a suite of key-sequence to the corresponding ASCII code.
Types ¶
type State ¶
type State struct {
// contains filtered or unexported fields
}
State represents the state of the terminal.
func SaveState ¶
SaveState saves the state of the terminal connected to the given file descriptor.
func SetRawTerminal ¶
SetRawTerminal puts the terminal connected to the given file descriptor into raw mode and returns the previous state.
type Winsize ¶
Winsize represents the size of the terminal window.
func GetWinsize ¶
GetWinsize returns the window size based on the specified file descriptor.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
pkg/term/windows |
- Version
- v1.11.2
- Published
- Jun 1, 2016
- Platform
- js/wasm
- Imports
- 8 packages
- Last checked
- 14 seconds ago –
Tools for package owners.