Skip to content

Instantly share code, notes, and snippets.

@a2ikm
Created April 12, 2011 13:27
Show Gist options
  • Select an option

  • Save a2ikm/915496 to your computer and use it in GitHub Desktop.

Select an option

Save a2ikm/915496 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# coding: utf-8
class String
def color num
"\e[#{num}m#{self}\e[0m"
end
def ask
print "#{self}"
gets.strip
end
def ask_password
system("stty -echo")
print "#{self}"
gets.strip
ensure
system("stty echo")
end
end
if __FILE__ == $0
login = "Login: ".color(36).ask
pass = "Password: ".color(31).ask_password
puts ""
end
@a2ikm
Copy link
Copy Markdown
Author

a2ikm commented Jul 23, 2011

@a2ikm
Copy link
Copy Markdown
Author

a2ikm commented Jul 23, 2011

refer http://ambiesoft.ddo.jp/blog/archives/1122 for colors. it's written in japanese

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment