Skip to content

Instantly share code, notes, and snippets.

@ahogen
Last active November 12, 2017 02:27
Show Gist options
  • Save ahogen/00c1f91471ddf32556cfdbfe4c3168c1 to your computer and use it in GitHub Desktop.
Save ahogen/00c1f91471ddf32556cfdbfe4c3168c1 to your computer and use it in GitHub Desktop.
Julia busy indicator with ADCII dots
###############################################################################
# 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
@ahogen
Copy link
Author

ahogen commented Nov 12, 2017

Should turn off cursor before and after the spinner. Should also look for q character from user to quit "nicely" and restore cursor blink.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment