spinner

package
v2.20.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithProvider

func WithProvider(ctx context.Context, sp Provider) context.Context

Types

type Provider

type Provider interface {
	New(string) Spinner
}

type Spinner

type Spinner interface {
	Helper()

	// Start spinning the spinner.
	Start()

	// Done stops the spinner and prints a success icon.
	Done()

	// IsNoOp returns true for the noop spinner and false for all other spinners.
	IsNoOp() bool

	// DoneMsg stops the spinner and sets the success icon with a new message.
	DoneMsg(msg string)

	// Error prints the error to the spinner, stops the spinner, then returns the error
	// so that you can continue passing it if needed.
	Error(err error) error

	// Message writes a message to the current spinner displayed alongside the initial job message.
	Message(msg string)
}

func New

func New(ctx context.Context, job string) Spinner

New configures a new spinner with the default values displaying the job message.

Jump to

Keyboard shortcuts

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