Skip to content

Instantly share code, notes, and snippets.

@thomasjslone
Created June 9, 2016 17:37
Show Gist options
  • Save thomasjslone/e722e1315211ffa8a7c0257ddac4d492 to your computer and use it in GitHub Desktop.
Save thomasjslone/e722e1315211ffa8a7c0257ddac4d492 to your computer and use it in GitHub Desktop.
update or write over previously written lines in consol, control caret, carriage
@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