Playing with $stdout


#1

Hi,

I’m trying to create a library of functions for programs that use a
command line interface. One feature I’d like to implement is a
date_selector. What I’d like to have is the $stdout display todays date
with one field somehow highlighted. The user could then navigate and
adjust using the arrow keys untill the desired date is set and press
Enter. My problem is that I’m not sure how to rewrite something that’s
already been printed to the standard output, if that’s possible at all.

Does any of this make sense or am I crazy?


#2

You can probably accomplish that with the standard curses library:
http://ruby-doc.org/stdlib/libdoc/curses/rdoc/index.html

Or the ncurses-ruby library:
http://ncurses-ruby.berlios.de/

The “documentation” for the former is pretty much just a list of
functions. The second one seems to be a fairly direct mapping to the
ncurses C library, so you can use documentation for the C library. As
far as I know, ncurses is one of the most popular libraries for doing
manipulation of the console.

-Brett