terminal

package
v0.0.0-...-5119c6c Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 3 Imported by: 16

Documentation

Overview

Package terminal contains helpers for working with Unix-like terminals.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Caps

type Caps struct {
	SupportsCursor bool // supports CursorUp and CursorDown control characters
}

Caps are capabilities of the terminal.

func Enable

func Enable(f *os.File) (caps *Caps, done func())

Enable switches the console attached to the given file (if any) into a terminal mode and returns its capabilities.

Returns (nil, nil) if the given file is not associated with a terminal or it can't be switched into a terminal mode.

On success returns a function that must be called once all terminal interactions are done.

On Unix, this just checks the file is associated with a terminal and fetches some properties of this terminal. On Windows, it actually switches the console into a virtual terminal mode. The returned completion callback will switch it back into its original mode.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL