spinner

package
v0.0.0-...-5afa41d Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Spinner

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

Spinner implements a command line spinner

func NewSpinner

func NewSpinner(msgPrefix string) *Spinner

NewSpinner creates an instance of cmd line spinner Args:

ctx: a system context with cancel, the spinner stops

when context is cancelled

msgPrefix:  a message prefix to be printed on

begining of every line

func (*Spinner) Start

func (s *Spinner) Start(ctx context.Context)

Start should be called as a go routine this func listen for new messages on the spinner channel change the message in the cmd line if a new message is available also responsible for an ascii spinner

func (*Spinner) Update

func (s *Spinner) Update(msg string) error

Update updates the current message that the spinner is printing by default the msg will be an empty string

Args:
	msg: the message to be printed

Jump to

Keyboard shortcuts

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