term

package
v0.0.0-...-587aff0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Println

func Println(in string, data interface{}, fs ...string) error

Println will print a formatted string out to a writer

func PrintlnTmpl

func PrintlnTmpl(tmpl string, data interface{}, fs ...string) error

PrintlnTmpl will print a formatted string out to a writer

Types

type ScreenBuf

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

ScreenBuf is a convenient way to write to terminal screens. It creates, clears and, moves up or down lines as needed to write the output to the terminal using ANSI escape codes.

func NewScreenBuf

func NewScreenBuf(w io.Writer, sources ...string) *ScreenBuf

NewScreenBuf creates and initializes a new ScreenBuf.

func (*ScreenBuf) Flush

func (s *ScreenBuf) Flush() error

Flush will flush the render buffer to the screen, this should be called after sever calls to Write

func (*ScreenBuf) Render

func (s *ScreenBuf) Render(in string, data interface{}) error

Render will write a text/template out to the console, using a mutex so that only a single writer at a time can write. This prevents the buffer from losing sync with the newlines

func (*ScreenBuf) RenderTmpl

func (s *ScreenBuf) RenderTmpl(tmpl string, data interface{}) error

RenderTmpl will write an already parsed text/template out to the console, using a mutex so that only a single writer at a time can write. This prevents the buffer from losing sync with the newlines

func (*ScreenBuf) Reset

func (s *ScreenBuf) Reset() error

Reset will empty the buffer and refill it with control characters that will clear the previous data on the next flush call.

func (*ScreenBuf) Write

func (s *ScreenBuf) Write(in string, data interface{}) error

Write will write to the buffer, this will not render to the screen without calling Flush. It will also not reset the screen, this is append only. Call reset first.

func (*ScreenBuf) WriteTmpl

func (s *ScreenBuf) WriteTmpl(tmpl string, data interface{}) error

WriteTmpl will write an already parsed template to the buffer, this will not render to the screen without calling Flush. It will also not reset the screen, this is append only. Call reset first.

Jump to

Keyboard shortcuts

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