terminal

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2024 License: Apache-2.0, MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Line

type Line struct {
	// contains filtered or unexported fields
}

func (*Line) Clear

func (l *Line) Clear()

func (*Line) Print

func (l *Line) Print(v ...any) (n int, err error)

func (*Line) Printf

func (l *Line) Printf(format string, v ...any) (n int, err error)

func (*Line) Println

func (l *Line) Println(v ...any) (n int, err error)

func (*Line) Write

func (l *Line) Write(p []byte) (n int, err error)

type Terminal

type Terminal struct {
	// contains filtered or unexported fields
}

func New

func New(w io.Writer) (terminal *Terminal, ok bool)

New constructs a terminal from the given writer, if it's a valid terminal.

If the writer is not a terminal, then terminal will be nil, and ok will be false.

func (*Terminal) Bottom

func (t *Terminal) Bottom() *Terminal

func (*Terminal) Clear

func (t *Terminal) Clear() *Terminal

func (*Terminal) ClearLine

func (t *Terminal) ClearLine() *Terminal

func (*Terminal) Close

func (t *Terminal) Close()

Close closes the terminal, and re-shows the cursor if it was hidden.

func (*Terminal) Column

func (t *Terminal) Column() int

Column returns the current column of the cursor.

func (*Terminal) Down

func (t *Terminal) Down(rows int) *Terminal

func (*Terminal) HideCursor

func (t *Terminal) HideCursor()

HideCursor hides the cursor.

func (*Terminal) Left

func (t *Terminal) Left(cols int) *Terminal

func (*Terminal) Line

func (t *Terminal) Line(n int) *Line

func (*Terminal) Move

func (t *Terminal) Move(row, col int) *Terminal

func (*Terminal) MoveColumn

func (t *Terminal) MoveColumn(col int) *Terminal

func (*Terminal) MoveRow

func (t *Terminal) MoveRow(row int) *Terminal

func (*Terminal) Offset

func (t *Terminal) Offset() (int, int)

Offset returns the current row and column of the cursor, offset from where the cursor was initially created.

func (*Terminal) Print

func (t *Terminal) Print(n int, args ...any) (int, error)

Print prints the given arguments to the terminal.

func (*Terminal) Printf

func (t *Terminal) Printf(n int, format string, args ...any) (int, error)

Printf prints the given arguments to the terminal, using the given format.

func (*Terminal) Println

func (t *Terminal) Println(n int, args ...any) (int, error)

Println prints the given arguments to the terminal, followed by a newline.

func (*Terminal) Right

func (t *Terminal) Right(cols int) *Terminal

func (*Terminal) Row

func (t *Terminal) Row() int

Row returns the current row of the cursor.

func (*Terminal) SetColumn

func (t *Terminal) SetColumn(n int) *Terminal

func (*Terminal) SetPosition

func (t *Terminal) SetPosition(row, col int) *Terminal

func (*Terminal) SetRow

func (t *Terminal) SetRow(n int) *Terminal

func (*Terminal) ShowCursor

func (t *Terminal) ShowCursor()

ShowCursor shows the cursor.

func (*Terminal) Top

func (t *Terminal) Top() *Terminal

func (*Terminal) Up

func (t *Terminal) Up(rows int) *Terminal

Up moves the cursor up the given number of rows. It cannot exceed the point where the cursor was initially created.

func (*Terminal) Width

func (t *Terminal) Width() int

func (*Terminal) Write

func (t *Terminal) Write(p []byte) (int, error)

Write writes the given bytes to the cursor, updating the row and column.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳