class Terminimal::Spinner

Overview

Utility for emitting single line user feedback to STDOUT while a long running process is taking place.

NOTE at the time of writing Crystal does not support parallel operations. When using a spinner to provide feedback during a long-running, CPU bound operation, you must manually invoke Fiber.yield to allow the fiber to be released and output from the spinner to be evaluated. IO bound operations will automatically release while awaiting resolution.

Defined in:

terminimal/spinner.cr

Constant Summary

UPDATE_INTERVAL = 0.15

Constructors

Instance Method Summary

Constructor Detail

def self.new(await, message, style : Style | CharSequence = Style::UNI_DOTS) #

Creates a new spinner instance.

Spinners will continue to run until await returns true. During operation they will continue to output the result of evaluting message to STDOUT, clearing the line, and overwriting itself on each update.

The style of the spinning can be of the builtin Style options, or alternatively any custom CharSequence.


[View source]

Instance Method Detail

def run #

Start spinning.


[View source]