class Terminimal::Spinner
- Terminimal::Spinner
- Reference
- Object
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.crConstant Summary
-
UPDATE_INTERVAL =
0.15
Constructors
-
.new(await : -> Bool, message : -> String, style : Style | CharSequence = Style::UNI_DOTS)
Creates a new spinner instance.
Instance Method Summary
-
#run
Start spinning.
Constructor Detail
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
.