Documentation ¶
Index ¶
- type ResizeEvent
- type StopEvent
- type Terminal
- func (t *Terminal) Clear() error
- func (t *Terminal) Close() error
- func (t *Terminal) InitRaw(input bool) error
- func (t *Terminal) IsAttached() bool
- func (t *Terminal) Resize(width, height int16) error
- func (t *Terminal) RestoreCursor() error
- func (t *Terminal) SaveCursor() error
- func (t *Terminal) SetCursorPos(x, y int) error
- func (t *Terminal) SetWindowTitle(s string) error
- func (t *Terminal) Size() (width int16, height int16, err error)
- func (t *Terminal) Stderr() io.Writer
- func (t *Terminal) Stdin() io.Reader
- func (t *Terminal) Stdout() io.Writer
- func (e *Terminal) Subscribe() chan interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ResizeEvent ¶
type ResizeEvent struct{}
ResizeEvent is emitted when a terminal window is resized.
type Terminal ¶
type Terminal struct {
// contains filtered or unexported fields
}
Terminal is used to configure raw input and output modes for an attached terminal emulator.
func New ¶
New creates a new Terminal instance. Callers should call `InitRaw` to configure the terminal for raw input or output modes.
Note that the returned Terminal instance must be closed to ensure the terminal is properly reset; unexpected exits may leave users' terminals unusable.
func (*Terminal) InitRaw ¶
InitRaw puts the terminal into raw mode. On Unix, no special input handling is required beyond simply reading from stdin, so `input` has no effect. Note that some implementations may replace one or more streams (particularly stdin).
func (*Terminal) IsAttached ¶
IsAttached determines if this terminal is attached to an interactive console session.
func (*Terminal) Resize ¶
Resize makes a best-effort attempt to resize the terminal window. Support varies between platforms and terminal emulators.
func (*Terminal) RestoreCursor ¶
RestoreCursor restores the last saved cursor position.
func (*Terminal) SaveCursor ¶
SaveCursor saves the current cursor position.
func (*Terminal) SetCursorPos ¶
SetCursorPos sets the cursor position to the given x, y coordinates. Coordinates are 1-indexed. (1, 1) represents the top left corner.
func (*Terminal) SetWindowTitle ¶
SetWindowTitle sets the terminal window's title.