progress

package
v0.0.0-...-67031d6 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2025 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	StyleDefaultChars = progress.StyleChars{
		BoxLeft:       "[",
		BoxRight:      "]",
		Finished:      "#",
		Finished25:    ".",
		Finished50:    ".",
		Finished75:    ".",
		Indeterminate: progress.IndeterminateIndicatorMovingBackAndForth("<#>", progress.DefaultUpdateFrequency/2),
		Unfinished:    ".",
	}
	StyleDefaultColors = progress.StyleColors{
		Message: text.Colors{text.FgWhite},
		Error:   text.Colors{text.FgRed},
		Percent: text.Colors{text.FgHiRed},
		Pinned:  text.Colors{text.BgHiBlack, text.FgWhite, text.Bold},
		Stats:   text.Colors{text.FgHiBlack},
		Time:    text.Colors{text.FgGreen},
		Tracker: text.Colors{text.FgYellow},
		Value:   text.Colors{text.FgCyan},
		Speed:   text.Colors{text.FgMagenta},
	}
	StyleDefaultOptions = progress.StyleOptions{
		DoneString:              "done!",
		ErrorString:             "fail!",
		ETAPrecision:            time.Second,
		ETAString:               "~ETA",
		PercentFormat:           "%4.2f%%",
		PercentIndeterminate:    " ??? ",
		Separator:               " ... ",
		SnipIndicator:           "~",
		SpeedPosition:           progress.PositionRight,
		SpeedPrecision:          time.Microsecond,
		SpeedOverallFormatter:   progress.FormatNumber,
		SpeedSuffix:             "/s",
		TimeDonePrecision:       time.Millisecond,
		TimeInProgressPrecision: time.Microsecond,
		TimeOverallPrecision:    time.Second,
	}
)
View Source
var (
	StyleDownload = NewStyle("download", progress.StyleVisibility{
		ETA:            true,
		ETAOverall:     true,
		Percentage:     true,
		Pinned:         false,
		Speed:          true,
		SpeedOverall:   true,
		Time:           true,
		Tracker:        true,
		TrackerOverall: false,
		Value:          true,
	}, nil)
)
View Source
var (
	StyleUnkown = NewStyle("unkown", progress.StyleVisibility{
		ETA:            false,
		ETAOverall:     false,
		Percentage:     false,
		Pinned:         false,
		Speed:          false,
		SpeedOverall:   false,
		Time:           true,
		Tracker:        true,
		TrackerOverall: false,
		Value:          false,
	}, &StyleOverwrites{
		TimeInProgressPrecision: time.Second,
	})
)

Functions

func NewStyle

func NewStyle(name string, visibility progress.StyleVisibility, overwrites *StyleOverwrites) progress.Style

func ProgressDone

func ProgressDone(tracker *progress.Tracker, message string, err error)

Types

type ReaderCloser

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

func NewReader

func NewReader(body io.ReadCloser, tracker *progress.Tracker) *ReaderCloser

func (*ReaderCloser) Close

func (r *ReaderCloser) Close() error

func (*ReaderCloser) Read

func (r *ReaderCloser) Read(p []byte) (n int, err error)

type StyleOverwrites

type StyleOverwrites struct {
	TimeInProgressPrecision time.Duration
}

type Writer

type Writer struct {
	progress.Writer
}

func NewWriter

func NewWriter(style progress.Style, out io.Writer) *Writer

func (*Writer) AddTracker

func (w *Writer) AddTracker(message string, total int64) *progress.Tracker

Jump to

Keyboard shortcuts

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