Documentation ¶
Index ¶
- Variables
- func MockMeter(meter Meter) func()
- type ANSIMeter
- func (*ANSIMeter) Finished()
- func (*ANSIMeter) Notify(msgstr string)
- func (p *ANSIMeter) Set(current float64)
- func (p *ANSIMeter) SetTotal(total float64)
- func (p *ANSIMeter) Spin(msgstr string)
- func (p *ANSIMeter) Start(label string, total float64)
- func (p *ANSIMeter) Write(bs []byte) (n int, err error)
- type Meter
- type NullMeter
- type QuietMeter
Constants ¶
This section is empty.
Variables ¶
View Source
var Null = NullMeter{}
Null is a default NullMeter instance
Functions ¶
Types ¶
type ANSIMeter ¶
type ANSIMeter struct {
// contains filtered or unexported fields
}
ANSIMeter is a progress.Meter that uses ANSI escape codes to make better use of the available horizontal space.
type Meter ¶
type Meter interface { // Start progress with max "total" steps Start(label string, total float64) // set progress to the "current" step Set(current float64) // set "total" steps needed SetTotal(total float64) // Finish the progress display Finished() // Indicate indefinite activity by showing a spinner Spin(msg string) // interface for writer Write(p []byte) (n int, err error) // notify the user of miscellaneous events Notify(string) }
Meter is an interface to show progress to the user
func MakeProgressBar ¶
func MakeProgressBar() Meter
MakeProgressBar creates an appropriate progress.Meter for the environ in which it is called:
- if MockMeter has been called, return that.
- if no terminal is attached, or we think we're running a test, a minimalistic QuietMeter is returned.
- otherwise, an ANSIMeter is returned.
TODO: instead of making the pivot at creation time, do it at every call.
type QuietMeter ¶
type QuietMeter struct{ NullMeter }
QuietMeter is a Meter that _just_ shows Notify()s.
func (QuietMeter) Notify ¶
func (QuietMeter) Notify(msg string)
Click to show internal directories.
Click to hide internal directories.