Last active
November 12, 2017 02:27
-
-
Save ahogen/00c1f91471ddf32556cfdbfe4c3168c1 to your computer and use it in GitHub Desktop.
Julia busy indicator with ADCII dots
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################### | |
# File: julia_busy_dots.jl | |
# Author: Alex Hogen (@ahogen on Github) | |
# | |
# Print a little busy/waiting indicator to the screen. | |
# | |
# Start: | |
# $ julia julia_busy_dots.jl | |
# Stop: | |
# $ Ctrl+C | |
############################################################################### | |
step = 1 | |
delay = 0.1 | |
dot_spinner = ["[ ]" | |
"[• ]" | |
"[•• ]" | |
"[ •• ]" | |
"[ •• ]" | |
"[ ••]" | |
"[ •]"] | |
while true | |
for step in dot_spinner | |
flush(STDOUT) | |
print("\r") | |
print(step) | |
flush(STDOUT) | |
sleep(delay) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should turn off cursor before and after the spinner. Should also look for
q
character from user to quit "nicely" and restore cursor blink.