pbar

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package pbar implements a simple percentage-based terminal progress indicator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bar

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

A Bar is a progress indicator. Method of a Bar are safe for concurrent use by multiple goroutines.

func New

func New(w io.Writer, max int64) *Bar

New contructs a new Bar with the given maximum value that writes a status line periodically to w. Call Start to begin updating the progress line, and Stop to stop it.

func (*Bar) Add

func (b *Bar) Add(v int64)

Add addsd v to the current value of the bar. The offset may be negative. If the resulting value is less than zero it is pinned to zero. If the resulting value exceeds the current maximum the bar length is extended.

func (*Bar) Set

func (b *Bar) Set(v int64)

Set sets the current value of the bar to v. If v exceeds the current maximum, the bar length is extended.

func (*Bar) SetMeta

func (b *Bar) SetMeta(v int64)

SetMeta sets the current value of the meta-counter.

func (*Bar) Start

func (b *Bar) Start() *Bar

Start begins rendering the status line for b.

func (*Bar) Stop

func (b *Bar) Stop()

Stop stops rendering the status line for b.

Jump to

Keyboard shortcuts

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