terminal

package
v0.0.0-...-1b5e7ed Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefinitionName = "terminal"
)
View Source
const DefinitionNameBuffer = "buffer"

Variables

View Source
var (
	Definition = di.Def{
		Name: DefinitionName,
		Build: func(ctn di.Container) (interface{}, error) {
			return newTerminal()
		},
	}
)
View Source
var (
	DefinitionBuffer = di.Def{
		Name: DefinitionNameBuffer,
		Build: func(ctn di.Container) (interface{}, error) {
			return newBuffer(), nil
		},
	}
)

Functions

func NewFlexibleTable

func NewFlexibleTable() *flexibleTable

func NewPlainText

func NewPlainText(text string) *plainText

Types

type Buffer

type Buffer interface {
	Push(Output)
	Pop() (Output, bool)
	Len() int
}

type Color

type Color int
const (
	ColorBlack Color = iota
	ColorRed
	ColorGreen
	ColorYellow
	ColorBlue
	ColorMagenta
	ColorCyan
	ColorWhite
)

type Output

type Output interface {
	Words(width, height int) []Word
}

type Terminal

type Terminal interface {
	ResetTerminal() error
	Width() int
	Height() int
	ReadRunes() ([]rune, error)
	WriteToConsole(s string) int
	Color() Color
	SetColor(color Color)
	MoveCursorToPosition(x, y int)
	MoveCursorToStart()
	MoveCursorBack(steps int)
	MoveCursorForward(steps int)
	MoveCursorUp(steps int)
	MoveCursorDown(steps int)
	MoveCursorTo(col int)
	EraseScreen(mode int)
	ShowCursor()
	HideCursor()
	EraseToEnd()
	EraseToStart()
	EraseLine()
	InsertLine()
	ScrollUp()
	ScrollDown()
}

type Word

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

func NewWord

func NewWord(text string, color Color) Word

func (*Word) Color

func (o *Word) Color() Color

func (*Word) Len

func (o *Word) Len() int

func (*Word) SetColor

func (o *Word) SetColor(color Color)

func (*Word) SetText

func (o *Word) SetText(text string)

func (*Word) Text

func (o *Word) Text() string

Jump to

Keyboard shortcuts

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