spinner

package
v0.0.0-...-8684de4 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: Apache-2.0 Imports: 6 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 is a simple and efficient CLI loading spinner used by kind It is simplistic and assumes that the line length will not change.

func NewSpinner

func NewSpinner(w io.Writer) *Spinner

NewSpinner initializes and returns a new Spinner that will write to w NOTE: w should be os.Stderr or similar, and it should be a Terminal

func (*Spinner) SetPrefix

func (s *Spinner) SetPrefix(prefix string)

SetPrefix sets the prefix to print before the spinner

func (*Spinner) SetSuffix

func (s *Spinner) SetSuffix(suffix string)

SetSuffix sets the suffix to print after the spinner

func (*Spinner) Start

func (s *Spinner) Start()

Start starts the spinner running

func (*Spinner) Stop

func (s *Spinner) Stop()

Stop signals the spinner to stop

func (*Spinner) Write

func (s *Spinner) Write(p []byte) (n int, err error)

Write implements io.Writer, interrupting the spinner and writing to the inner writer

type Status

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

Status is used to track ongoing status in a CLI, with a nice loading spinner when attached to a terminal

func NewStatus

func NewStatus() *Status

NewStatus returns a new status object

func (*Status) End

func (s *Status) End(success bool)

End completes the current status, ending any previous spinning and marking the status as success or failure

func (*Status) Start

func (s *Status) Start(status string)

Start starts a new phase of the status, if attached to a terminal there will be a loading spinner with this status

Jump to

Keyboard shortcuts

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