# Ruby Readline Maintainer

**URL:** <https://www.ruby-forum.com/t/ruby-readline-maintainer/172775>\
**Category:** Ruby\
**Created:** [July 27, 2009, 10:08pm UTC](https://www.ruby-forum.com/t/ruby-readline-maintainer/172775 "2009-07-27T22:08:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![roxah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/54ee81/32.png) [@roxah](https://www.ruby-forum.com/u/roxah)\
**Post date:** [July 27, 2009, 10:08pm UTC](https://www.ruby-forum.com/t/ruby-readline-maintainer/172775/1 "2009-07-27T22:08:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![roxah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/54ee81/32.png) [@roxah](https://www.ruby-forum.com/u/roxah)\
**Post date:** [July 27, 2009, 10:35pm UTC](https://www.ruby-forum.com/t/ruby-readline-maintainer/172775/2 "2009-07-27T22:35:29Z")

</div>

On Jul 27, 2009, at 13:08, Bryan R. wrote:

> 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.

You’ll want to ask on the ruby-core list, or file a bug on redmine.

> […]

> 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.

Yeah, try filing a bug (or bug with patch) here:

> **[Ruby Issue Tracking System](https://redmine.ruby-lang.org)**
>
> Redmine

The best way to get it noticed is to provide a short, concise piece of  
example code that doesn’t work the way you want.

---

<div class="post-metadata">

**Author:** ![roxah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/54ee81/32.png) [@roxah](https://www.ruby-forum.com/u/roxah)\
**Post date:** [July 27, 2009, 10:36pm UTC](https://www.ruby-forum.com/t/ruby-readline-maintainer/172775/3 "2009-07-27T22:36:39Z")

</div>

On Jul 27, 2009, at 13:08 , Bryan R. wrote:

> 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.

send it to ruby-core@

---

<div class="post-metadata">

**Author:** ![roxah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/54ee81/32.png) [@roxah](https://www.ruby-forum.com/u/roxah)\
**Post date:** [July 28, 2009, 6:11am UTC](https://www.ruby-forum.com/t/ruby-readline-maintainer/172775/4 "2009-07-28T06:11:24Z")

</div>

Bryan R. wrote:

> 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.

Please consider pr-readline, which is pure Ruby and easily  
modifiable/extendable.

Another option is rawline.

Regards,

Dan

---

<div class="post-metadata">

**Author:** ![roxah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/54ee81/32.png) [@roxah](https://www.ruby-forum.com/u/roxah)\
**Post date:** [July 28, 2009, 6:58am UTC](https://www.ruby-forum.com/t/ruby-readline-maintainer/172775/5 "2009-07-28T06:58:13Z")

</div>

Oh wow… that’s nice to know!!! 🙂 Thanks!

---

<div class="post-metadata">

**Author:** ![roxah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/54ee81/32.png) [@roxah](https://www.ruby-forum.com/u/roxah)\
**Post date:** [July 27, 2009, 11:34pm UTC](https://www.ruby-forum.com/t/ruby-readline-maintainer/172775/6 "2009-07-27T23:34:08Z")

</div>

Thanks for the suggestions. Will do.

---

<div class="post-metadata">

**Author:** ![roxah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/54ee81/32.png) [@roxah](https://www.ruby-forum.com/u/roxah)\
**Post date:** [July 28, 2009, 10:40am UTC](https://www.ruby-forum.com/t/ruby-readline-maintainer/172775/7 "2009-07-28T10:40:36Z")

</div>

> 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.

I guess. I would just set Readline.completion\_append\_character right  
in the proc itself.  
But if you do it for one, then you’d have to do it for all completion  
cases.

If you want to give your completion proc the full  
line you’ve typed along  
with a powerful completion dsl, check out bond:

> **[GitHub - cldwalker/bond: Mission: Easy custom autocompletion for arguments,...](https://github.com/cldwalker/bond/tree/master#readme)**
>
> master

Gabriel
