progress

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToCtx

func ToCtx(ctx context.Context, v Progress) context.Context

Types

type Mode

type Mode string
const (
	AutoMode Mode = "auto"
	NoMode   Mode = "no"
)

type Option

type Option interface {
	Opt() progressbar.Option
}

func WithBytes

func WithBytes(enabled bool) Option

func WithCleanOnFinish

func WithCleanOnFinish() Option

func WithDescription

func WithDescription(desc string) Option

func WithElapsedTime

func WithElapsedTime(elapsed bool) Option

func WithIts

func WithIts() Option

func WithMax

func WithMax(m int64) Option

func WithOnComplete

func WithOnComplete(f func()) Option

func WithPredictTime

func WithPredictTime(predict bool) Option

func WithShowElapsedTime

func WithShowElapsedTime() Option

func WithSpinnerType

func WithSpinnerType(spinnerType int) Option

func WithTheme

func WithTheme(t Theme) Option

func WithWidth

func WithWidth(w int) Option

type OptionFunc

type OptionFunc func() progressbar.Option

func (OptionFunc) Opt

func (o OptionFunc) Opt() progressbar.Option

type Progress

type Progress interface {
	io.Writer

	Add(delta int64)
	Inc()

	// Finish fills bar to full
	Finish()
	// Exit progress and leave progress at current state
	Exit()

	Alter(opts ...Option) Progress
}

func FromCtx

func FromCtx(ctx context.Context) Progress

func Init

func Init(m Mode) (Progress, error)

func New

func New(w io.Writer, options ...Option) Progress

func NopProgress

func NopProgress() Progress

type Theme

type Theme struct {
	Saucer        string
	AltSaucerHead string
	SaucerHead    string
	SaucerPadding string
	BarStart      string
	BarEnd        string
}

Jump to

Keyboard shortcuts

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