class Term::Spinner
- Term::Spinner
- Reference
- Object
Defined in:
spinner/formats.crspinner/multi.cr
spinner/version.cr
term-spinner.cr
Constant Summary
-
CROSS =
"✖"
-
ECMA_CSI =
"\e["
-
FORMATS =
{"classic" => {interval: 10, frames: ["|", "/", "-", "\\"]}, "spin" => {interval: 10, frames: ["◴", "◷", "◶", "◵"] of ::String}, "spin_2" => {interval: 10, frames: ["◐", "◓", "◑", "◒"] of ::String}, "spin_3" => {interval: 10, frames: ["◰", "◳", "◲", "◱"] of ::String}, "spin_4" => {interval: 10, frames: ["╫", "╪"] of ::String}, "pulse" => {interval: 10, frames: ["⎺", "⎻", "⎼", "⎽", "⎼", "⎻"] of ::String}, "pulse_2" => {interval: 15, frames: ["▁", "▃", "▅", "▆", "▇", "█", "▇", "▆", "▅", "▃"] of ::String}, "pulse_3" => {interval: 20, frames: ["▉", "▊", "▋", "▌", "▍", "▎", "▏", "▎", "▍", "▌", "▋", "▊", "▉"] of ::String}, "dots" => {interval: 10, frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"] of ::String}, "dots_2" => {interval: 10, frames: ["⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷"] of ::String}, "dots_3" => {interval: 10, frames: ["⠋", "⠙", "⠚", "⠞", "⠖", "⠦", "⠴", "⠲", "⠳", "⠓"] of ::String}, "dots_4" => {interval: 10, frames: ["⠄", "⠆", "⠇", "⠋", "⠙", "⠸", "⠰", "⠠", "⠰", "⠸", "⠙", "⠋", "⠇", "⠆"] of ::String}, "dots_5" => {interval: 10, frames: ["⠋", "⠙", "⠚", "⠒", "⠂", "⠂", "⠒", "⠲", "⠴", "⠦", "⠖", "⠒", "⠐", "⠐", "⠒", "⠓", "⠋"] of ::String}, "dots_6" => {interval: 10, frames: ["⠁", "⠉", "⠙", "⠚", "⠒", "⠂", "⠂", "⠒", "⠲", "⠴", "⠤", "⠄", "⠄", "⠤", "⠴", "⠲", "⠒", "⠂", "⠂", "⠒", "⠚", "⠙", "⠉", "⠁"] of ::String}, "dots_7" => {interval: 10, frames: ["⠈", "⠉", "⠋", "⠓", "⠒", "⠐", "⠐", "⠒", "⠖", "⠦", "⠤", "⠠", "⠠", "⠤", "⠦", "⠖", "⠒", "⠐", "⠐", "⠒", "⠓", "⠋", "⠉", "⠈"] of ::String}, "dots_8" => {interval: 10, frames: ["⠁", "⠁", "⠉", "⠙", "⠚", "⠒", "⠂", "⠂", "⠒", "⠲", "⠴", "⠤", "⠄", "⠄", "⠤", "⠠", "⠠", "⠤", "⠦", "⠖", "⠒", "⠐", "⠐", "⠒", "⠓", "⠋", "⠉", "⠈", "⠈"] of ::String}, "dots_9" => {interval: 10, frames: ["⢹", "⢺", "⢼", "⣸", "⣇", "⡧", "⡗", "⡏"] of ::String}, "dots_10" => {interval: 10, frames: ["⢄", "⢂", "⢁", "⡁", "⡈", "⡐", "⡠"] of ::String}, "dots_11" => {interval: 10, frames: ["⠁", "⠂", "⠄", "⡀", "⢀", "⠠", "⠐", "⠈"] of ::String}, "arrow" => {interval: 10, frames: ["←", "↖", "↑", "↗", "→", "↘", "↓", "↙"] of ::String}, "arrow_pulse" => {interval: 10, frames: ["▹▹▹▹▹", "▸▹▹▹▹", "▹▸▹▹▹", "▹▹▸▹▹", "▹▹▹▸▹", "▹▹▹▹▸"]}, "triangle" => {interval: 10, frames: ["◢", "◣", "◤", "◥"] of ::String}, "arc" => {interval: 10, frames: ["◜", "◠", "◝", "◞", "◡", "◟"] of ::String}, "pipe" => {interval: 10, frames: ["┤", "┘", "┴", "└", "├", "┌", "┬", "┐"] of ::String}, "bouncing" => {interval: 10, frames: ["[ ]", "[ =]", "[ ==]", "[ ===]", "[====]", "[=== ]", "[== ]", "[= ]"]}, "bouncing_ball" => {interval: 10, frames: ["( ● )", "( ● )", "( ● )", "( ● )", "( ●)", "( ● )", "( ● )", "( ● )", "( ● )", "(● )"]}, "bounce" => {interval: 10, frames: ["⠁", "⠂", "⠄", "⠂"] of ::String}, "box_bounce" => {interval: 10, frames: ["▌", "▀", "▐", "▄"] of ::String}, "box_bounce_2" => {interval: 10, frames: ["▖", "▘", "▝", "▗"] of ::String}, "star" => {interval: 10, frames: ["✶", "✸", "✹", "✺", "✹", "✷"] of ::String}, "toggle" => {interval: 10, frames: ["■", "□", "▪", "▫"] of ::String}, "balloon" => {interval: 10, frames: [".", "o", "O", "@", "*"] of ::String}, "balloon_2" => {interval: 10, frames: [".", "o", "O", "°", "O", "o", "."] of ::String}, "flip" => {interval: 10, frames: ["-", "◡", "⊙", "-", "◠"] of ::String}, "burger" => {interval: 6, frames: ["☱", "☲", "☴"] of ::String}, "dance" => {interval: 10, frames: [">))'>", " >))'>", " >))'>", " >))'>", " >))'>", " <'((<", " <'((<", " <'((<"]}, "shark" => {interval: 10, frames: ["▐|\\____________▌", "▐_|\\___________▌", "▐__|\\__________▌", "▐___|\\_________▌", "▐____|\\________▌", "▐_____|\\_______▌", "▐______|\\______▌", "▐_______|\\_____▌", "▐________|\\____▌", "▐_________|\\___▌", "▐__________|\\__▌", "▐___________|\\_▌", "▐____________|\\▌", "▐____________/|▌", "▐___________/|_▌", "▐__________/|__▌", "▐_________/|___▌", "▐________/|____▌", "▐_______/|_____▌", "▐______/|______▌", "▐_____/|_______▌", "▐____/|________▌", "▐___/|_________▌", "▐__/|__________▌", "▐_/|___________▌", "▐/|____________▌"]}, "pong" => {interval: 10, frames: ["▐⠂ ▌", "▐⠈ ▌", "▐ ⠂ ▌", "▐ ⠠ ▌", "▐ ⡀ ▌", "▐ ⠠ ▌", "▐ ⠂ ▌", "▐ ⠈ ▌", "▐ ⠂ ▌", "▐ ⠠ ▌", "▐ ⡀ ▌", "▐ ⠠ ▌", "▐ ⠂ ▌", "▐ ⠈ ▌", "▐ ⠂▌", "▐ ⠠▌", "▐ ⡀▌", "▐ ⠠ ▌", "▐ ⠂ ▌", "▐ ⠈ ▌", "▐ ⠂ ▌", "▐ ⠠ ▌", "▐ ⡀ ▌", "▐ ⠠ ▌", "▐ ⠂ ▌", "▐ ⠈ ▌", "▐ ⠂ ▌", "▐ ⠠ ▌", "▐ ⡀ ▌", "▐⠠ ▌"]}}
-
MATCHER =
/:spinner/
-
TICK =
"✔"
-
VERSION =
"0.1.0"
Constructors
Instance Method Summary
-
#attach_to(multispinner : Multi)
Notifies the
Spinner
that it is running under a multispinner -
#auto_spin
Start automatic spinning animation
-
#clear_line
Clear the current line
-
#done? : Bool
Whether the spinner has completed spinning
-
#duration
Duration of the spinning animation
-
#error(stop_message = "")
Finish spinning and set state to :error
-
#error?
Whether the spinner is in the error state.
-
#execute_job
Execute this spinner job
- #execute_on_line(&)
-
#first_run? : Bool
Whether this is the first time this spinner has ran
-
#frames : Array(String)
The animation frames
-
#hide_cursor : Bool
Whether to show or hide the cursor
-
#interval : Time::Span
The animation interval
-
#job(&work : Spinner -> )
Add job to the spinner
-
#job : Term::Spinner -> Nil?
Get the current job
-
#job?
Check if this spinner has a scheduled job
-
#message : String
The message to print before the spinner
- #multispinner : Multi | Nil
-
#next_char
Retrieve next character
-
#on(name, &block : Spinner -> )
Register a callback
-
#output : IO::FileDescriptor
The object that responds to print call defaulting to stderr
-
#pause
Pause the spinner
-
#paused?
Whether the spinner is paused
-
#redraw_indent
Redraw the indent for this spinner, if it exists
- #reset
-
#resume
Resume spinner
-
#row : Int32 | Nil
The current row inside a multi spinner
-
#run(stop_message = "", &block : Spinner -> )
Runspinner while executing job
-
#spin
Perform a spin
-
#spinning?
Whether the spinner is spinning
-
#start
Start timer and unlock spinner
-
#state : Symbol
The current spinner state
-
#stop(stop_message = "")
Stop the running spinner
-
#stopped?
Whether spinner is stopped
-
#success(stop_message = "")
Finish spinning and set state to :success
-
#success?
Whether the spinner is in the success state.
-
#tokens : Hash(String, String)
Tokens for the message
- #tty?
-
#update(**tokens)
Update string formatting tokens
Constructor Detail
Instance Method Detail
Notifies the Spinner
that it is running under a multispinner
Whether the spinner is in the error state. This is only true temporarily while it is being marked with a failure mark.
Whether the spinner is in the success state. When true the spinner is marked with a success mark.