Documentation ¶
Overview ¶
Package state implements state tracking for a task. Its progress from 0.0 to 1.0, log messages, etc.
Index ¶
- func EnableBeepsForAdam()
- type Consumer
- func (c *Consumer) CountCallback(totalSize int64) counter.CountCallback
- func (c *Consumer) Debug(msg string)
- func (c *Consumer) Debugf(msg string, args ...interface{})
- func (c *Consumer) Error(msg string)
- func (c *Consumer) Errorf(msg string, args ...interface{})
- func (c *Consumer) Info(msg string)
- func (c *Consumer) Infof(msg string, args ...interface{})
- func (c *Consumer) Logf(msg string, args ...interface{})
- func (c *Consumer) Opf(msg string, args ...interface{})
- func (c *Consumer) PauseProgress()
- func (c *Consumer) Progress(progress float64)
- func (c *Consumer) ProgressLabel(label string)
- func (c *Consumer) ResumeProgress()
- func (c *Consumer) Statf(msg string, args ...interface{})
- func (c *Consumer) Warn(msg string)
- func (c *Consumer) Warnf(msg string, args ...interface{})
- type MessageCallback
- type ProgressCallback
- type ProgressLabelCallback
- type ProgressTheme
- type VoidCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnableBeepsForAdam ¶
func EnableBeepsForAdam()
EnableBeepsForAdam is there for backwards compatibility, but mostly, fun
Types ¶
type Consumer ¶
type Consumer struct { OnProgress ProgressCallback OnPauseProgress VoidCallback OnResumeProgress VoidCallback OnProgressLabel ProgressLabelCallback OnMessage MessageCallback }
Consumer holds callbacks for the various state changes one might want to consume (show progress to the user, store messages in a text file, etc.)
func (*Consumer) CountCallback ¶
func (c *Consumer) CountCallback(totalSize int64) counter.CountCallback
CountCallback returns a function suitable for counter.NewWriterCallback or counter.NewReaderCallback
func (*Consumer) Opf ¶
Opf logs an "operation" message (prefixed by OpSign) For example, "Extracting (file.zip)"
func (*Consumer) PauseProgress ¶
func (c *Consumer) PauseProgress()
PauseProgress temporarily stops updating progress bars
func (*Consumer) Progress ¶
Progress announces the degree of completion of a task, in the [0,1] interval
func (*Consumer) ProgressLabel ¶
ProgressLabel gives extra info about which task is currently being executed
func (*Consumer) ResumeProgress ¶
func (c *Consumer) ResumeProgress()
ResumeProgress resumes updating progress bars
type MessageCallback ¶
type MessageCallback func(level, msg string)
MessageCallback is called when a log message has to be printed
type ProgressCallback ¶
type ProgressCallback func(alpha float64)
ProgressCallback is called periodically to announce the degree of completeness of an operation
type ProgressLabelCallback ¶
type ProgressLabelCallback func(label string)
ProgressLabelCallback is called when the progress label should be changed
type ProgressTheme ¶
type ProgressTheme struct { BarStart string BarEnd string Current string CurrentHalfTone string Empty string OpSign string StatSign string Separator string }
ProgressTheme contains all the characters we need to show progress
type VoidCallback ¶
type VoidCallback func()
VoidCallback is the type of OnPauseProgress/OnResumeProgress callbacks