James Gray
3/13/2007 3:04:00 PM
On Mar 13, 2007, at 10:00 AM, ara.t.howard@noaa.gov wrote:
> On Tue, 13 Mar 2007, Trans wrote:
>
>> This has been asked about before, and I've been wondering about it
>> myself. So I worked on it and came up with this. I know it's rather a
>> poor man's way of handling it but at least it's light and portable
>> (well, at least I think it is).
>>
>> def password( msg=nil )
>> msg ||= "Enter Password"
>> inp = ''
>>
>> i = Thread.new{ inp = $stdin.gets }
>> c = Thread.new do
>> loop do
>> sleep 0.01
>> $stdout << "\r#{msg}: "
>> $stdout << "\r#{msg}: "
>> $stdout.flush
>> end
>> end
>>
>> i.join
>>
>> return inp
>> end
>
> gem install highline !!
I agree. :)
James Edward Gray II