progress

package
Version: v0.0.0-...-51f9457 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package progress implements a progress indicator for text mode applications.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	Name      string
	Formatter Formatter
	Value     int64
}

Column represent a column to be printed in the progress status.

type Formatter

type Formatter func(i int64) string

Formatter formats numbers in a Column.

type Group

type Group int

Group identifies a column group to keep progress for.

type Progress

type Progress interface {
	io.Closer
	// Update increases the count of a column.
	Update(group Group, section Section, count int64)
}

Progress outputs information about the progress of a long task.

It's implementation must be thread safe.

func New

func New(columns [][]Column, out io.Writer) Progress

New returns an initialized thread-safe Progress implementation.

columns is the number of stages each item must go through, then with a set of numbers for each state, which will be displayed as a number in each box.

For:

columns = [][]Column{{Name:"found"}, {"hashed", Name:"to hash"}}

It'll print:

[found] [hashed/to hash]

type Section

type Section int

Section identifies a particular column in a column group.

Source Files

Jump to

Keyboard shortcuts

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