console

package
v0.0.0-...-4ef7734 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Console

type Console struct {
	File *os.File
	// contains filtered or unexported fields
}

Console represents the TTY

func NewConsole

func NewConsole() *Console

NewConsole initializes a Console object

func (*Console) AddRow

func (c *Console) AddRow(text string) Row

AddRow adds a row at the end of the console

func (*Console) AddRows

func (c *Console) AddRows(texts ...string) []Row

AddRows adds multiple rows at the end of the console

func (*Console) EditRow

func (c *Console) EditRow(id Row, text string) <-chan struct{}

EditRow replaces the given row with the given string (asynchronously). Returns a channel that will be closed upon completion.

func (*Console) Summary

func (c *Console) Summary(text string) <-chan struct{}

Summary places a text at the very bottom (asynchronously) Returns a channel that will be closed upon completion.

type Row

type Row int

Row - line number / ID in console

type UpdatingConsole

type UpdatingConsole struct {
	File *os.File
	// contains filtered or unexported fields
}

UpdatingConsole manages output to the TTY in a fixed-interval

func Updating

func Updating(update time.Duration) *UpdatingConsole

Updating initializes an UpdatingConsole object that updates the console every `update`

func (*UpdatingConsole) Add

func (c *UpdatingConsole) Add(text func() string)

Add adds a row at the end of the console.

func (*UpdatingConsole) AddConst

func (c *UpdatingConsole) AddConst(text string)

AddConst is a convenience method for Add with an invariable string.

func (*UpdatingConsole) Close

func (c *UpdatingConsole) Close(update bool)

Close releases this console's goroutines. Updates if true is passed.

func (*UpdatingConsole) Insert

func (c *UpdatingConsole) Insert(at int, text func() string)

Insert adds the specified string at the given line number. Can be a negative number for negative indexing if line number exceeds total amount of lines, row will be inserted at the end instead.

func (*UpdatingConsole) InsertConst

func (c *UpdatingConsole) InsertConst(at int, text string)

AddConst is a convenience method for Add with an invariable string.

Jump to

Keyboard shortcuts

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