Hey guys,
To try out this “post blog articles to the list, maybe insight some
discussion” idea, I offer the community this. I maintain the “Stupid
Ruby Tricks” wiki over at http://sn.oplo.ws and I recently compiled a
bit of a “best of”. Check it!
http://concentrationstudios.com/2006/12/20/12-days-of-stupid-ruby-tricks
Firstly, I appologize if this question has already been answered but I
could not figure out the
correct way to word my search on google to find anything relevant. I am
running Ruby 1.8.2-15
on windows XP. I used the one-click version.
I am trying to write a script that will prompt a user for a password and
not echo the characters back to screen.
Is this possible in the dos command window? If so then please give me a
reference else is there an alternative
such as using TK?
thank you,
raymond
On 12/30/06, Jacob, Raymond A Jr [email protected] wrote:
such as using TK?
thank you,
raymond
page 791 and 792 of the ruby cookbook covers this.
require ‘rubygems’
require ‘highline/import’
def get_password(prompt='Password: ')
ask(prompt) { |q| q.echo = false}
end
get_password(“What’s your password?”)
On Dec 30, 2006, at 11:56 PM, Jason M. wrote:
password and
page 791 and 792 of the ruby cookbook covers this.require ‘rubygems’
require ‘highline/import’def get_password(prompt='Password: ')
ask(prompt) { |q| q.echo = false}
endget_password(“What’s your password?”)
Or just:
require “rubygems”
require “highline/import”
ask("Password: ") { |q| q.echo = false }
END
James Edward G. II
Jason:
Thank you,
I guess I should buy the ruby cookbook?
Thank you again
Raymond
From: Jason M. [mailto:[email protected]]
Sent: Sun 12/31/2006 1:23 AM
To: Jacob, Raymond A Jr
Subject: Re: Ruby for Windows:How does one not echo keyboard input?
On 12/31/06, Jason M. [email protected] wrote:
On 12/30/06, Jason M. <[email protected] > wrote:
On 12/30/06, Jacob, Raymond A Jr <[email protected]> wrote:
>
> Firstly, I appologize if this question has already been answered
but I
> could not figure out the
> correct way to word my search on google to find anything relevant. I
am
> running Ruby 1.8.2-15
> on windows XP. I used the one-click version.
> I am trying to write a script that will prompt a user for a password
and
> not echo the characters back to screen.
> Is this possible in the dos command window? If so then please give
me a
> reference else is there an alternative
> such as using TK?
>
> thank you,
> raymond
>
>
page 791 and 792 of the ruby cookbook covers this.
require 'rubygems'
require 'highline/import'
def get_password(prompt='Password: ')
ask(prompt) { |q| q.echo = false}
end
get_password("What's your password?")
I don't believe this is for windows, but there's a library for it here:
http://www.caliban.org/ruby/ruby-password.shtml
I also had to do this to get it to work (on the off change you are as
new as I am to ruby)
gem install highline