Created
June 9, 2016 17:37
-
-
Save thomasjslone/e722e1315211ffa8a7c0257ddac4d492 to your computer and use it in GitHub Desktop.
update or write over previously written lines in consol, control caret, carriage
This file contains hidden or 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
@perc = 0 | |
t = Thread.new { loop do ; @perc += 1 ; sleep 0.15 ; end } | |
until @perc == 100 | |
puts "Downloading: (" + @perc.to_s + "%)" | |
print "\r" #carret to beginning of line | |
print "\e[A" #carret up one line | |
sleep 0.050 | |
end | |
puts "Downloading: (100%)" | |
#print "\r\e[A" | |
puts "\nDonload Complete" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment