Skip to content

Latest commit

 

History

History
70 lines (52 loc) · 5.02 KB

spinner.md

File metadata and controls

70 lines (52 loc) · 5.02 KB

SpinnerPrinter

SpinnerPrinter Example

(Show source of demo)

Usage

Basic usage

pterm.DefaultSpinner.Start()

Functions

Function Description
Fail(message ...interface{}) Fail displays the fail printer. If no message is given, the text of the SpinnerPrinter will be reused as the default message.
Success(message ...interface{}) Success displays the success printer. If no message is given, the text of the SpinnerPrinter will be reused as the default message.
UpdateText(text string) UpdateText updates the message of the active SpinnerPrinter. Can be used live.
Warning(message ...interface{}) Warning displays the warning printer. If no message is given, the text of the SpinnerPrinter will be reused as the default message.

Options

To make a copy with modified options you can use: pterm.DefaultSpinner.WithOptionName(option)

To change multiple options at once, you can chain the functions: pterm.DefaultSpinner.WithOptionName(option).WithOptionName2(option2)...

Tip

Click the options and types to show the documentation on pkg.go.dev

Option Type
Delay time.Duration
MessageStyle *Style
RemoveWhenDone ...bool
Sequence ...string
Style *Style
Text string
ShowTimer ...bool
TimerRoundingFactor time.Duration
TimerStyle *Style
Writer io.Writer

Output functions

This printer implements the interface LivePrinter

Function Description
Start() Returns itself and possible errors
Stop() Returns itself and possible errors
GenericStart() Returns the started LivePrinter and possible errors
GenericStop() Returns the stopped LivePrinter and possible errors

Note

The generic start and stop methods are only used to implement the printer into the interface. Use the normal Start() and Stop() methods if possible.

Related