Created
June 4, 2013 03:29
-
-
Save stevenocchipinti/5703381 to your computer and use it in GitHub Desktop.
Simple example of using Curses (built in to the ruby stdlib)
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
#!/usr/local/bin/ruby | |
require "curses" | |
include Curses | |
begin | |
init_screen | |
crmode | |
x = 0 | |
y = 0 | |
setpos(x, y) | |
addstr("Hit any key") | |
refresh | |
getch | |
setpos(x, y+12) | |
addstr("... AGAIN!") | |
refresh | |
getch | |
ensure | |
close_screen | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Curses clears the screen
These characters move the cursor up and clear the line:
These characters were found in the KarmaJS source (thanks Seb)
This article may be useful:
http://www.linuxselfhelp.com/howtos/Bash-Prompt/Bash-Prompt-HOWTO-6.html