Readline insists in ordering the returned array

  • Thread starter Iñaki Baz Castillo
  • Start date
I

Iñaki Baz Castillo

Hi, I want to use Ruby Readline for a custom console. Commands are
"ddd", "bbb", "aaa", "ccc" and I want they to be shown in *that* order
when pressing TAB with empty buffered line. Example code:

--------------------------------------------------------------------
#!/usr/bin/ruby

require "readline"

commands =3D %w{ddd bbb aaa ccc}

Readline.completion_proc =3D proc do |s|
commands
end

while line =3D Readline.readline(">>> ", true)
end
---------------------------------------------------------------------

Running it:
aaa bbb ccc ddd


I strongly need that the commands are shown in the original order! but
Readline shorts them:
ddd bbb aaa ccc


Being a C ruby code I expect it's hard to monkey patch it. Maybe I
miss something to keep the order of the array?

Thanks a lot.

--=20
I=C3=B1aki Baz Castillo
<[email protected]>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top