cwriter

package
v7.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2022 License: Unlicense Imports: 6 Imported by: 1

Documentation

Overview

Package cwriter is a console writer abstraction for the underlying OS.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotTTY = errors.New("not a terminal")

ErrNotTTY not a TeleTYpewriter error.

Functions

func GetSize

func GetSize(fd int) (width, height int, err error)

GetSize returns the dimensions of the given terminal.

func IsTerminal

func IsTerminal(fd int) bool

IsTerminal returns whether the given file descriptor is a terminal.

Types

type Writer

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

Writer is a buffered the writer that updates the terminal. The contents of writer will be flushed when Flush is called.

func New

func New(out io.Writer) *Writer

New returns a new Writer with defaults.

func (*Writer) Flush

func (w *Writer) Flush(lines int) (err error)

Flush flushes the underlying buffer.

func (*Writer) GetWidth

func (w *Writer) GetWidth() (int, error)

GetWidth returns width of underlying terminal.

func (*Writer) ReadFrom

func (w *Writer) ReadFrom(r io.Reader) (n int64, err error)

ReadFrom reads from the provided io.Reader and writes to the underlying buffer.

func (*Writer) Write

func (w *Writer) Write(p []byte) (n int, err error)

Write appends the contents of p to the underlying buffer.

func (*Writer) WriteString

func (w *Writer) WriteString(s string) (n int, err error)

WriteString writes string to the underlying buffer.

Jump to

Keyboard shortcuts

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