spinner

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FramesBall          = Frames{"∙∙∙", "●∙∙", "∙●∙", "∙∙●", "∙∙∙"}
	FramesBarHorizontal = Frames{"▏", "▎", "▍", "▌", "▋", "▊", "▉", "▊", "▋", "▌", "▍", "▎"}
	FramesBarsVertical  = Frames{"▁", "▃", "▄", "▅", "▆", "▇", "█", "▇", "▆", "▅", "▄", "▃", "▁"}
)

Functions

This section is empty.

Types

type Frames

type Frames []string

Frames ...

type Option

type Option func(*Widget)

Option will apply the provided configuration to a spinner instance.

func WithFrameRate

func WithFrameRate(value time.Duration) Option

WithFrameRate adds color style

func WithFrames

func WithFrames(value Frames) Option

WithFrames adds color style

func WithHideCursor

func WithHideCursor(value bool) Option

WithHideCursor adds color style

func WithLabel

func WithLabel(value string) Option

WithLabel adds color style

func WithMaxWidth

func WithMaxWidth(value int) Option

WithMaxWidth adds color style

func WithOutput

func WithOutput(value io.Writer) Option

WithOutput adds color style

func WithStyle

func WithStyle(value *gchalk.Builder) Option

WithStyle adds color style

type Widget

type Widget struct {
	sync.Mutex
	Label     string
	Frames    Frames
	FrameRate time.Duration

	Output io.Writer

	Style      *gchalk.Builder
	MaxWidth   int
	HideCursor bool
	// contains filtered or unexported fields
}

Widget is the spinner struct

func New

func New(options ...Option) *Widget

New creates a new Spinner instance

func (*Widget) SetLabel

func (s *Widget) SetLabel(label string) *Widget

SetLabel updates the label value

func (*Widget) Start

func (s *Widget) Start() *Widget

Start starts the spinner

func (*Widget) Stop

func (s *Widget) Stop() *Widget

Stop will stop the spinner

Jump to

Keyboard shortcuts

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