progress

package module
v0.0.0-...-c485e79 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2020 License: MIT Imports: 6 Imported by: 12

README

Examples


GoDoc

Documentation

Overview

Package progress provides a simple terminal progress bar.

Example
b := progress.NewInt(50)

for i := 0; i <= 50; i++ {
	b.ValueInt(i)
	b.Text(fmt.Sprintf("iteration %d", i))
	b.WriteTo(os.Stdout)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bar

type Bar struct {
	StartDelimiter string  // StartDelimiter for the bar ("|").
	EndDelimiter   string  // EndDelimiter for the bar ("|").
	Filled         string  // Filled section representation ("█").
	Empty          string  // Empty section representation ("░")
	Total          float64 // Total value.
	Width          int     // Width of the bar.
	// contains filtered or unexported fields
}

Bar is a progress bar.

func New

func New(total float64) *Bar

New returns a new bar with the given total.

func NewInt

func NewInt(total int) *Bar

NewInt returns a new bar with the given total.

func (*Bar) String

func (b *Bar) String() string

String returns the progress bar.

func (*Bar) Template

func (b *Bar) Template(s string)

Template for rendering. This method will panic if the template fails to parse.

func (*Bar) Text

func (b *Bar) Text(s string)

Text sets the text value.

func (*Bar) Value

func (b *Bar) Value(n float64)

Value sets the value.

func (*Bar) ValueInt

func (b *Bar) ValueInt(n int)

ValueInt sets the value.

func (*Bar) WriteTo

func (b *Bar) WriteTo(w io.Writer) (int64, error)

WriteTo writes the progress bar to w.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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