On 14 Lis, 14:52, James Gray <ja... / grayproductions.net> wrote:
> On Nov 14, 2008, at 4:23 AM, szimek wrote:
>
> > Hi,
>
> Hello.
>
> > I've got an array of user logins and need to provide a way to select
> > one or more of them with auto-completion. Currently I've got code
> > straight from readline example:
>
> > users = ask("Select users: ", user_logins) do |q|
> >  ¨Â®òåáäìéîôòõå
> > end
>
> > The problem is that it says "You must choose one of...." if I select
> > more than one login. How to allow to select multiple choices?
>
> Is it okay to ask the user to enter one login per line with a blank > line to end?  ¨Âóïôèéó ãïäå óèïõìä ÷ïòë>
> #!/usr/bin/env ruby -wKU
>
> require "rubygems"
> require "highline/import"
>
> LOGINS = %w[bob joe dave alice hal]
>
> selected = ask("Select Users:", LOGINS + [""]) do |q|
>  ¨Â®òåáäìéîôòõå
>  ¨Â®çáôè墢
> end
> p selected
>
> __END__
>
> Hope that helps.
>
> James Edward Gray II

Thanks, I'll probably use this solution for now, but is it possible at
all with highline to make it in a single line?

Another question: I'd like user to be able to select a ticket number
from a list with auto-complete. But if user presses tab, I'd like to
display not only possible ticket numbers, but their descriptions as
well - one entry (i.e. "1234 - something doesn't work") per line, if
it's possible.