Variable editing in ruby (like zsh vared)

I am redoing some zsh apps in ruby (commandline). One functionality was
that of zsh’s vared, which allows editing of a variable. (it also allows
tab completion of paths which was a big bonus).

The closest I could get in ruby was the String.gets(), however this
gives a blank string to the user. From what i recall Highline allows
using the arrow key to get history (which is great) but not the same.

Is this functionality implemented somewhere that I’ve missed? Or in some
gem?

Thanks

On Wed, Feb 20, 2013 at 1:11 PM, R. Kumar [email protected] wrote:

I am redoing some zsh apps in ruby (commandline). One functionality was
that of zsh’s vared, which allows editing of a variable. (it also allows
tab completion of paths which was a big bonus).

The closest I could get in ruby was the String.gets(), however this
gives a blank string to the user. From what i recall Highline allows
using the arrow key to get history (which is great) but not the same.

Is this functionality implemented somewhere that I’ve missed? Or in some
gem?

Off the top of my head “readline” might help. See “ri Readline”.

Kind regards

robert

Robert K. wrote in post #1097965:

Off the top of my head “readline” might help. See “ri Readline”.

Kind regards

robert

Actually, i meant readline (not highline). Yes, readline allows tab
completion which is part of the requirement, but I don’t think it can
directly edit without going into history with UP-arrow.

The syntax is:

 buf = Readline.readline("> ", true)

so i cannot give buf to the method.

http://www.ruby-doc.org/stdlib-1.9.3/libdoc/readline/rdoc/Readline.html

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs