Hello all,

Does anyone know who maintains the Ruby Readline extension?  I'm using
Readline in a Ruby application I have written to provide a console
interface and I have a suggestion for the extension.

It's possible to specify a proc that, given the current string a user
has entered before hitting tab, Readline will use to do some command
completion.  Most often, the proc parses through an array of command
names and/or directory and file names to see if the given string matches
any of them.  This works just fine.

Readline also lets you specify a character to append to the end of the
string after command completion has succeeded (i.e. a space after a
matched command or a '/' after a matched directory).  This is where my
problem comes in.  In the command completion proc, I'm providing an
array comprised of available commands in the application as well as a
list of possible directories given the string provided (i.e. Dir[str +
'*']).  Thus, depending on what the string is determined to be (a
command, a directory, or a file), I'd like to assign either a space or a
'/' as the append character.

The easiest way I see to do this is to be able to provide a proc to the
Readline.completion_append_character variable rather than a string, and
have the completed command string passed to the proc.  This way, one can
determine if the string is a command, a directory, or a file and return
the appropriate append string.

--
Thanks!
Bryan
-- 
Posted via http://www.ruby-forum.com/.