termstatus

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2018 License: BSD-2-Clause Imports: 9 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Terminal

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

Terminal is used to write messages and display status lines which can be updated. When the output is redirected to a file, the status lines are not printed.

func New

func New(ctx context.Context, dst TerminalWriter) *Terminal

New returns a new Terminal for dst. A goroutine is started to update the terminal. It is terminated when ctx is cancelled. When dst is redirected to a file (e.g. via shell output redirection), no status lines are printed.

func (*Terminal) Finish

func (t *Terminal) Finish() error

Finish removes the status lines.

func (*Terminal) Print

func (t *Terminal) Print(line string) error

Print writes a line to the terminal.

func (*Terminal) Printf

func (t *Terminal) Printf(msg string, args ...interface{}) error

Printf uses fmt.Sprintf to write a line to the terminal.

func (*Terminal) SetStatus

func (t *Terminal) SetStatus(lines []string) error

SetStatus updates the status lines.

type TerminalWriter

type TerminalWriter interface {
	io.Writer
	Fd() uintptr
}

TerminalWriter is an io.Writer which also has a file descriptor.

Directories

Path Synopsis
examples
basic command
reader command
Package progress provides functions to inform the user about the status of an ongoing operation via a terminal.
Package progress provides functions to inform the user about the status of an ongoing operation via a terminal.

Jump to

Keyboard shortcuts

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