Documentation ¶
Overview ¶
Package term provides terminal utilities.
Index ¶
- func IsTerminal(f io.Writer) bool
- func Read() (ch byte, ok bool)
- func Size() (columns, rows int)
- func WrapText(out io.Writer, prefix, text string)
- type ANSI
- func (a *ANSI) Background(color Color)
- func (a *ANSI) Bell()
- func (a *ANSI) Clear()
- func (a *ANSI) ClearToEnd()
- func (a *ANSI) ClearToStart()
- func (a *ANSI) Down(count int)
- func (a *ANSI) EraseLine()
- func (a *ANSI) EraseLineToEnd()
- func (a *ANSI) EraseLineToStart()
- func (a *ANSI) Foreground(color Color, style Style)
- func (a *ANSI) HideCursor()
- func (a *ANSI) Left(count int)
- func (a *ANSI) Position(row, column int)
- func (a *ANSI) Reset()
- func (a *ANSI) RestorePosition()
- func (a *ANSI) Right(count int)
- func (a *ANSI) SavePosition()
- func (a *ANSI) ShowCursor()
- func (a *ANSI) Up(count int)
- func (a *ANSI) Write(p []byte) (n int, err error)
- type Color
- type Style
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsTerminal ¶
IsTerminal returns true if the writer's file descriptor is a terminal.
Types ¶
type ANSI ¶
type ANSI struct {
// contains filtered or unexported fields
}
ANSI provides support for ANSI terminal escape sequences.
func (*ANSI) Background ¶
Background sets the background color for subsequent output.
func (*ANSI) Clear ¶
func (a *ANSI) Clear()
Clear the screen and position the cursor at row 1, column 1.
func (*ANSI) ClearToEnd ¶
func (a *ANSI) ClearToEnd()
ClearToEnd clears the screen from the cursor to the end of the screen.
func (*ANSI) ClearToStart ¶
func (a *ANSI) ClearToStart()
ClearToStart clears the screen from the cursor to the beginning of the screen.
func (*ANSI) Down ¶
Down moves the cursor down 'count' rows. If this would put it beyond the bottom edge of the screen, it will instead go to the bottom edge of the screen.
func (*ANSI) EraseLineToEnd ¶
func (a *ANSI) EraseLineToEnd()
EraseLineToEnd clears from the cursor position to the end of the current row.
func (*ANSI) EraseLineToStart ¶
func (a *ANSI) EraseLineToStart()
EraseLineToStart clears from the cursor position to the start of the current row.
func (*ANSI) Foreground ¶
Foreground sets the foreground color and style for subsequent output.
func (*ANSI) Left ¶
Left moves the cursor left 'count' columns. If this would put it beyond the left edge of the screen, it will instead go to the left edge of the screen.
func (*ANSI) RestorePosition ¶
func (a *ANSI) RestorePosition()
RestorePosition restores the previously saved cursor position.
func (*ANSI) Right ¶
Right moves the cursor right 'count' columns. If this would put it beyond the right edge of the screen, it will instead go to the right edge of the screen.
func (*ANSI) SavePosition ¶
func (a *ANSI) SavePosition()
SavePosition saves the current cursor position.