progress

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2018 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Overview

Package progress implements progress indicators, which are used during state enforcement while running actions and plugins to estimate progress and show completion percentage to the user.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Console

type Console struct {
	// contains filtered or unexported fields
}

Console is a console-based progress indicator

func NewConsole

func NewConsole(title string) *Console

NewConsole creates a new console-based progress indicator

func (*Console) Advance

func (progressConsole *Console) Advance()

Advance advances progress indicator by one step

func (*Console) Done

func (progressConsole *Console) Done()

Done should be called once done working with progress indicator

func (Console) GetCompletionPercent

func (count Console) GetCompletionPercent() int

func (*Console) IsDone

func (progressConsole *Console) IsDone() bool

IsDone returns if progress indicator was already marked as Done()

func (*Console) SetOut

func (progressConsole *Console) SetOut(out io.Writer)

SetOut set output writer for writing progress information to

func (*Console) SetTotal

func (progressConsole *Console) SetTotal(total int)

SetTotal sets the total number of steps in a progress indicator

type Indicator

type Indicator interface {
	// SetTotal should be called to initialize progress indicator with 'total' steps
	SetTotal(total int)

	// Advance should be called to advance progress indicator by 1 step
	Advance()

	// Done should be called when you are done using progress indicator
	Done()

	// IsDone method should be called to check if progress indicator has already been marked as Done()
	IsDone() bool

	// GetCompletionPercent should be called to retrieve % of completion as integer. Note that you should rely on IsDone() instead of relying on 100% returned by this method
	GetCompletionPercent() int
}

Indicator is an interface which represents progress bar indicator

type Noop

type Noop struct {
	// contains filtered or unexported fields
}

Noop is a mock progress indicator which prints nothing

func NewNoop

func NewNoop() *Noop

NewNoop creates a new noop progress indicator

func (*Noop) Advance

func (progressNoop *Noop) Advance()

Advance advances progress indicator by one step

func (*Noop) Done

func (progressNoop *Noop) Done()

Done should be called once done working with progress indicator

func (Noop) GetCompletionPercent

func (count Noop) GetCompletionPercent() int

func (*Noop) IsDone

func (progressNoop *Noop) IsDone() bool

IsDone returns if progress indicator was already marked as Done()

func (*Noop) SetTotal

func (progressNoop *Noop) SetTotal(total int)

SetTotal sets the total number of steps in a progress indicator

Jump to

Keyboard shortcuts

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