progress

package
v0.0.0-...-7cedb2b Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2016 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

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(pkg 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) Finished

func (t *NullProgress) Finished()

Finished does nothing

func (*NullProgress) Notify

func (t *NullProgress) Notify(string)

Notify does nothing

func (*NullProgress) Set

func (t *NullProgress) Set(current float64)

Set does nothing

func (*NullProgress) SetTotal

func (t *NullProgress) SetTotal(total float64)

SetTotal does nothing

func (*NullProgress) Spin

func (t *NullProgress) Spin(msg string)

Spin does nothing

func (*NullProgress) Start

func (t *NullProgress) Start(pkg string, total float64)

Start does nothing

func (*NullProgress) Write

func (t *NullProgress) Write(p []byte) (n int, err error)

Write 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(pkg string, total float64)

Start starts showing progress

func (*TextProgress) Write

func (t *TextProgress) Write(p []byte) (n int, err error)

Write is there so that progress can implment a Writer and can be used to display progress of io operations

Jump to

Keyboard shortcuts

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