term

package
v0.5.23 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedOS = errors.New("unsupported operating system")
)

Functions

func DeviceMajor added in v0.5.19

func DeviceMajor[T constraints.Integer](rdev T) uint64

func DeviceMinor added in v0.5.19

func DeviceMinor[T constraints.Integer](rdev T) uint64

func ParseDims

func ParseDims(b []byte) (uint32, uint32)

ParseDims extracts terminal dimensions (width x height) from the provided buffer.

func ParseKeyValue

func ParseKeyValue(b []byte) (key, value string)

func ParseValue

func ParseValue(b []byte) (value string)

func SetWinSz

func SetWinSz(fd uintptr, w, h uint32) (err error)

SetWinSz sets the width and height for the given tty fd

Types

type TermType added in v0.5.19

type TermType uint8
const (
	InvalidTermType TermType = iota
	NotATTY
	ConsoleTTY
	PseudoTTY
)

func CharDeviceInfo added in v0.5.19

func CharDeviceInfo(path string) (major, minor uint64, ttyType TermType, yes bool)

CharDeviceInfo uses syscall.Stat to test if the path exists, is a character device (mode has S_IFCHR), parses the major and minor numbers out of syscall.Stat_t.Rdev and finally determines the TermType value based on the major and minor values

func ParseDeviceInfo added in v0.5.19

func ParseDeviceInfo[T constraints.Integer](dev T) (major, minor uint64, ttyType TermType)

func ResolveTTY added in v0.5.19

func ResolveTTY() (ttyPath string, ttyType TermType, err error)

func (TermType) String added in v0.5.19

func (tt TermType) String() (name string)

func (TermType) Valid added in v0.5.19

func (tt TermType) Valid() (valid bool)

Jump to

Keyboard shortcuts

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