Documentation
¶
Index ¶
- Constants
- type TermApp
- type Terminal
- func (t *Terminal) CaptureInput(ctx context.Context) (keys <-chan *input.Input, restore func(), err error)
- func (t *Terminal) Clear()
- func (t *Terminal) ClearString() string
- func (t *Terminal) HideCursor()
- func (t *Terminal) Overpaint() error
- func (t *Terminal) Print(values ...any)
- func (t *Terminal) Println(values ...any)
- func (t *Terminal) RunClearCommand()
- func (t *Terminal) ShowCursor()
Constants ¶
View Source
const ( TermAppAppleTerminal = "Apple_Terminal" TermAppITerm = "iTerm.app" TermAppVscode = "vscode" )
View Source
const ( EscClearScreen = "\x1b[2J" EscGotoTopLeft = "\x1b[0;0f" EscHideCursor = "\x1b[?25l" EscShowCursor = "\x1b[?25h" )
View Source
const EnvTermApp = "TERM_PROGRAM"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Terminal ¶
type Terminal struct {
// contains filtered or unexported fields
}
func NewTerminal ¶
NewTerminal returns a new terminal for the given file descriptor.
func (*Terminal) CaptureInput ¶
func (*Terminal) Clear ¶
func (t *Terminal) Clear()
Clear clears the screen and sets the cursor to 0,0.
func (*Terminal) ClearString ¶
ClearString returns the ANSI codes for clearing the screen and setting the cursor to 0,0.
func (*Terminal) HideCursor ¶
func (t *Terminal) HideCursor()
HideCursor sends ANSI escape code to hide the cursor.
func (*Terminal) Println ¶
Println prints the values to the terminal's file descriptor ending with a new line and an additional carriage return "\r", to produce valid lines on raw terminals.
func (*Terminal) RunClearCommand ¶
func (t *Terminal) RunClearCommand()
RunClearCommand runs a "clear" or similar command if supported by the OS. Panics if the OS does not support "clear".
func (*Terminal) ShowCursor ¶
func (t *Terminal) ShowCursor()
ShowCursor sends ANSI escape code to show the cursor.
Click to show internal directories.
Click to hide internal directories.