internal

package
v1.6.6 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MPL-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	InvalidInput = iota
	ArrowUp
	ArrowDown
	ArrowLeft
	ArrowRight
	Enter
	Cancel

	ModeNone = iota - 1
	ModeSome
	Mode8Bit
	ModeFull
)

Variables

View Source
var ErrInterrupted = errors.New("interrupted")

Functions

func DetectColorLevel

func DetectColorLevel(_ int) int

func GetWriterFd

func GetWriterFd(writer io.Writer) (int, bool)

func ReadCtx

func ReadCtx[T any](ctx context.Context, t *Terminal, readFn func(*Terminal) (T, error)) (T, error)

func WaitForInterrupt

func WaitForInterrupt(ctx context.Context)

Types

type Result

type Result[T any] struct {
	Val T
	Err error
}

func NewResult

func NewResult[T any](val T, err error) Result[T]

type Terminal

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

func OpenTTY

func OpenTTY(_ bool) (*Terminal, error)

func (*Terminal) Close

func (t *Terminal) Close()

func (*Terminal) HideCursor

func (t *Terminal) HideCursor()

func (*Terminal) ReadArrow

func (t *Terminal) ReadArrow() (int, error)

func (*Terminal) ReadKey

func (t *Terminal) ReadKey() (rune, error)

func (*Terminal) ReadLine

func (t *Terminal) ReadLine() ([]byte, error)

func (*Terminal) ReadMasked

func (t *Terminal) ReadMasked(out io.Writer, mask rune) ([]byte, error)

func (*Terminal) ReadVisible

func (t *Terminal) ReadVisible(out io.Writer, buf []byte, max int) ([]byte, error)

func (*Terminal) ShowCursor

func (t *Terminal) ShowCursor()

Jump to

Keyboard shortcuts

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