easyterm

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2020 License: GPL-3.0, GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package easyterm is a wrapper for "github.com/pkg/term/termios". it provides some features not present in the third-party package, such as terminal geometry, and wraps termios methods in functions with friendlier names

Package easyterm is a wrapper for "github.com/pkg/term/termios". it provides some features not present in the third-party package, such as terminal geometry, and wraps termios methods in functions with friendlier names

Index

Constants

View Source
const (
	KeyInterrupt      = 3  // end-of-text character
	KeySuspend        = 26 // substitute character
	KeyTab            = 9
	KeyCarriageReturn = 13
	KeyEsc            = 27
	KeyBackspace      = 127
	KeyCtrlH          = 8
)

list of ASCII codes for non-alphanumeric characters

View Source
const (
	EscDelete = 51
	EscCursor = 91
	EscHome   = 72
	EscEnd    = 70
)

list of ASCII code for characters that can follow KeyEsc

View Source
const (
	CursorUp       = 'A'
	CursorDown     = 'B'
	CursorForward  = 'C'
	CursorBackward = 'D'
)

list of ASCII code for characters that can follow EscCursor

Variables

This section is empty.

Functions

func SuspendProcess

func SuspendProcess()

SuspendProcess manually suspends the current process. This is useful if terminal is in raw mode and the terminal is given the suspend signal.

Types

type EasyTerm

type EasyTerm struct {
	Geometry TermGeometry
	// contains filtered or unexported fields
}

EasyTerm is the main container for posix terminals. usually embedded in other struct types

func (*EasyTerm) CBreakMode

func (et *EasyTerm) CBreakMode()

CBreakMode puts terminal into cbreak mode

func (*EasyTerm) CanonicalMode

func (et *EasyTerm) CanonicalMode()

CanonicalMode puts terminal into normal, everyday canonical mode

func (*EasyTerm) CleanUp

func (et *EasyTerm) CleanUp()

CleanUp closes resources created in the Initialise() function

func (*EasyTerm) Flush

func (et *EasyTerm) Flush() error

Flush makes sure the terminal's input/output buffers are empty

func (*EasyTerm) Initialise

func (et *EasyTerm) Initialise(inputFile, outputFile *os.File) error

Initialise the fields in the Terminal struct

func (*EasyTerm) RawMode

func (et *EasyTerm) RawMode()

RawMode puts terminal into raw mode

func (*EasyTerm) TermPrint

func (et *EasyTerm) TermPrint(s string)

TermPrint writes string to the output file

func (*EasyTerm) UpdateGeometry

func (et *EasyTerm) UpdateGeometry() error

UpdateGeometry gets the current dimensions (in characters and pixels) of the output terminal

type TermGeometry

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

TermGeometry contains the dimensions of a terminal (usually the output terminal)

Directories

Path Synopsis
Package ansi defines ANSI control codes for styles and colours.
Package ansi defines ANSI control codes for styles and colours.

Jump to

Keyboard shortcuts

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