Documentation
¶
Index ¶
- func NormalizePrompt(prompt string) string
- func SetDisableProgress(disable bool)
- type ProgressBar
- func (p *ProgressBar) Abort(name string, err error)
- func (p *ProgressBar) Add(prompt, name string, size int64, reader io.Reader) io.Reader
- func (p *ProgressBar) Complete(name string, msg string)
- func (p *ProgressBar) Get(name string) *progressBar
- func (p *ProgressBar) Reset(prompt, name string, size int64, reader io.Reader) io.Reader
- func (p *ProgressBar) Spinner(prompt, name string, size int64)
- func (p *ProgressBar) Start()
- func (p *ProgressBar) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizePrompt ¶
NormalizePrompt normalizes the prompt string.
func SetDisableProgress ¶
func SetDisableProgress(disable bool)
SetDisableProgress disables the progress bar.
Types ¶
type ProgressBar ¶
type ProgressBar struct {
// contains filtered or unexported fields
}
ProgressBar is a progress bar.
func NewProgressBar ¶
func NewProgressBar(writers ...io.Writer) *ProgressBar
NewProgressBar creates a new progress bar.
func (*ProgressBar) Abort ¶
func (p *ProgressBar) Abort(name string, err error)
Abort aborts the progress bar.
func (*ProgressBar) Complete ¶
func (p *ProgressBar) Complete(name string, msg string)
Complete completes the progress bar.
func (*ProgressBar) Get ¶
func (p *ProgressBar) Get(name string) *progressBar
Get returns the progress bar.
func (*ProgressBar) Reset ¶ added in v0.2.3
Reset resets an existing progress bar for a new phase. Aborts the old bar (if any, see Add for completed-bar semantics) and creates a new one with updated prompt, reset progress, and fresh speed counter. Creates the bar if it does not exist yet. Parameter order matches Add.
func (*ProgressBar) Spinner ¶ added in v0.2.3
func (p *ProgressBar) Spinner(prompt, name string, size int64)
Spinner adds an indeterminate bar for a phase that transfers no bytes, such as a remote existence check. It renders a spinner, the prompt, the total size, and the elapsed time. It has no byte counter and no transfer rate, so a slow phase does not show a misleading "0 B / N B" and "0 B/s". Call Reset (or Add) with the same name to replace it with a transfer bar once bytes start flowing, or Complete / Abort to finish it.