console

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunningOnTerminal

func RunningOnTerminal() bool

RunningOnTerminal checks whether stdout is terminal

Types

type Progress

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

Progress is a progress displaying subroutine, it allows to show download and other operations progress mixed with progress bar

func NewProgress

func NewProgress() *Progress

NewProgress creates new progress instance

func (*Progress) AddBar

func (p *Progress) AddBar(count int)

AddBar increments progress for progress bar

func (*Progress) ColoredPrintf

func (p *Progress) ColoredPrintf(msg string, a ...interface{})

ColoredPrintf does printf in colored way + newline

func (*Progress) Flush

func (p *Progress) Flush()

Flush waits for all queued messages to be displayed

func (*Progress) InitBar

func (p *Progress) InitBar(count int64, isBytes bool)

InitBar starts progressbar for count bytes or count items

func (*Progress) Printf

func (p *Progress) Printf(msg string, a ...interface{})

Printf does printf but in safe manner: not overwriting progress bar

func (*Progress) PrintfStdErr added in v1.1.0

func (p *Progress) PrintfStdErr(msg string, a ...interface{})

PrintfStdErr does printf but in safe manner to stderr

func (*Progress) SetBar

func (p *Progress) SetBar(count int)

SetBar sets current position for progress bar

func (*Progress) Shutdown

func (p *Progress) Shutdown()

Shutdown shuts down progress display

func (*Progress) ShutdownBar

func (p *Progress) ShutdownBar()

ShutdownBar stops progress bar and hides it

func (*Progress) Start

func (p *Progress) Start()

Start makes progress start its work

func (*Progress) Write

func (p *Progress) Write(s []byte) (int, error)

Write is implementation of io.Writer to support updating of progress bar

Jump to

Keyboard shortcuts

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