Documentation
¶
Index ¶
- type Spinner
- func (spinner *Spinner) ChangeData(newData SpinnerData)
- func (spinner *Spinner) Failure()
- func (spinner *Spinner) IsSpinning() bool
- func (spinner *Spinner) Start()
- func (spinner *Spinner) Stop()
- func (spinner *Spinner) StopAsync()
- func (spinner *Spinner) StopAsyncAndSignal() (stopChan chan struct{})
- func (spinner *Spinner) Success()
- type SpinnerData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Spinner ¶
type Spinner struct { // Text that will be printed before the spinner. Prefix string // Text that will be printed after the spinner but before the text. Suffix string // Text that will be printed after the end of the line. Text string // Prefix that will be shown after the spinner has stopped. StopPrefix *string // Suffix that will be shown after the spinner has stopped. StopSuffix *string // Text that will be shown after the spinner has stopped. StopText *string // Text replacing the spinner after it has stopped. StopFrame *string // contains filtered or unexported fields }
func (*Spinner) ChangeData ¶
func (spinner *Spinner) ChangeData(newData SpinnerData)
Changes the spinner's data.
This can also be called while the spinner is running.
func (*Spinner) Failure ¶
func (spinner *Spinner) Failure()
Stops the spinner, leaving a cross as the last frame.
func (*Spinner) IsSpinning ¶
Returns whether the spinner is spinning. While it is active, the current line will constantly get overwritten.
func (*Spinner) Start ¶
func (spinner *Spinner) Start()
Starts the spinner.
When this function is called while the spinner is already spinning, it will restart the spinner.
func (*Spinner) Stop ¶
func (spinner *Spinner) Stop()
Stops the spinner and blocks until finished.
It's safe to call this when the spinner has already stopped.
func (*Spinner) StopAsync ¶
func (spinner *Spinner) StopAsync()
Stops the spinner without blocking. You shouldn't write while the spinner is still spinning.
Like Stop(), this is safe to call when the spinner has already stopped.
func (*Spinner) StopAsyncAndSignal ¶
func (spinner *Spinner) StopAsyncAndSignal() (stopChan chan struct{})
Stops the spinner without blocking and returns a channel that will be closed when the spinner has stopped.