spinner

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2025 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithProgress

func WithProgress(message string, total int, fn func(update func())) error

WithProgress runs a function with a progress bar

func WithSpinner

func WithSpinner(message string, fn func() error) error

WithSpinner runs a function with a spinner

Types

type Progress

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

Progress represents a progress bar

func NewProgress

func NewProgress(message string, total int) *Progress

NewProgress creates a new progress bar

func (*Progress) Increment

func (p *Progress) Increment()

Increment increments the progress

func (*Progress) Set

func (p *Progress) Set(current int)

Set sets the progress to a specific value

func (*Progress) SetOutput

func (p *Progress) SetOutput(w io.Writer)

SetOutput sets the output writer

func (*Progress) Start

func (p *Progress) Start() *Progress

Start starts the progress bar

func (*Progress) Wait

func (p *Progress) Wait()

Wait waits for the progress bar to finish

type Spinner

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

Spinner represents a loading spinner

func New

func New(message string) *Spinner

New creates a new spinner

func (*Spinner) Fail

func (s *Spinner) Fail(err error)

Fail stops the spinner with an error

func (*Spinner) SetMessage

func (s *Spinner) SetMessage(message string)

SetMessage updates the spinner message

func (*Spinner) SetOutput

func (s *Spinner) SetOutput(w io.Writer)

SetOutput sets the output writer

func (*Spinner) Start

func (s *Spinner) Start() *Spinner

Start starts the spinner

func (*Spinner) Stop

func (s *Spinner) Stop()

Stop stops the spinner

func (*Spinner) Wait

func (s *Spinner) Wait()

Wait waits for the spinner to finish

Jump to

Keyboard shortcuts

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