Documentation
¶
Index ¶
- type Meter
- type NullProgress
- func (t *NullProgress) Finished()
- func (t *NullProgress) Notify(string)
- func (t *NullProgress) Set(current float64)
- func (t *NullProgress) SetTotal(total float64)
- func (t *NullProgress) Spin(msg string)
- func (t *NullProgress) Start(label string, total float64)
- func (t *NullProgress) Write(p []byte) (n int, err error)
- type TextProgress
- func (t *TextProgress) Agreed(intro, license string) bool
- func (t *TextProgress) Finished()
- func (*TextProgress) Notify(msg string)
- func (t *TextProgress) Set(current float64)
- func (t *TextProgress) SetTotal(total float64)
- func (t *TextProgress) Spin(msg string)
- func (t *TextProgress) Start(label string, total float64)
- func (t *TextProgress) Write(p []byte) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 miscelaneous events
Notify(string)
}
Meter is an interface to show progress to the user
func MakeProgressBar ¶
func MakeProgressBar() Meter
MakeProgressBar creates an appropriate progress (which may be a NullProgress bar if there is no associated terminal).
type NullProgress ¶
type NullProgress struct {
}
NullProgress is a Meter that does nothing
func (*NullProgress) SetTotal ¶
func (t *NullProgress) SetTotal(total float64)
SetTotal does nothing
func (*NullProgress) Start ¶
func (t *NullProgress) Start(label string, total float64)
Start does nothing
type TextProgress ¶
type TextProgress struct {
Meter
// contains filtered or unexported fields
}
TextProgress show progress on the terminal
func NewTextProgress ¶
func NewTextProgress() *TextProgress
NewTextProgress returns a new TextProgress type
func (*TextProgress) Agreed ¶
func (t *TextProgress) Agreed(intro, license string) bool
Agreed asks the user whether they agree to the given license text
func (*TextProgress) Finished ¶
func (t *TextProgress) Finished()
Finished stops displaying the progress
func (*TextProgress) Notify ¶
func (*TextProgress) Notify(msg string)
Notify the user of miscelaneous events
func (*TextProgress) Set ¶
func (t *TextProgress) Set(current float64)
Set sets the progress to the current value
func (*TextProgress) SetTotal ¶
func (t *TextProgress) SetTotal(total float64)
SetTotal set the total steps needed
func (*TextProgress) Spin ¶
func (t *TextProgress) Spin(msg string)
Spin advances a spinner, i.e. can be used to show progress for operations that have a unknown duration
func (*TextProgress) Start ¶
func (t *TextProgress) Start(label string, total float64)
Start starts showing progress