bar

package
v0.0.0-...-de190fe Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultRemainingStyle = NewStyle('─', style.New(style.FgBlack))
	DefaultCompletedStyle = NewStyle('─', style.New(style.FgRed))
	DefaultFinishedStyle  = NewStyle('─', style.New(style.FgGreen))
)

Default progress bar styles. These are used if the corresponding styles of a Bar are not explicitly set.

Functions

This section is empty.

Types

type Bar

type Bar struct {
	RemainingStyle *Style
	CompletedStyle *Style
	FinishedStyle  *Style
	MaxWidth       int
	Completed      float64
}

Bar renders a progress bar.

func New

func New(completed float64) Bar

New creates a new Bar which is completed by the specified percentage.

func (Bar) Measure

func (b Bar) Measure(maxWidth int) measure.Measurement

Measure implements console.Renderable.

func (Bar) Render

func (b Bar) Render(width int) string

Render implements console.Renderable.

type Style

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

Style is the style of a progress bar.

func NewStyle

func NewStyle(symbol rune, style *style.Style) *Style

NewStyle creates a new *Style. Will panic if symbol does not have a rune width of 1.

func (*Style) Measure

func (s *Style) Measure(_ int) measure.Measurement

Measure implements console.Renderable.

func (*Style) Render

func (s *Style) Render(width int) string

Render implements console.Renderable.

Jump to

Keyboard shortcuts

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