Sha256: 2dd1d661a43ea0f32daaf5249f430bf6bc684d78fba1d271d8b39d6e7a9d0ffd
Contents?: true
Size: 936 Bytes
Versions: 4
Compression:
Stored size: 936 Bytes
Contents
module Capistrano # The CLI class encapsulates the behavior of capistrano when it is invoked # as a command-line utility. This allows other programs to embed ST and # preserve it's command-line semantics. class CLI # Prompt for a password using echo suppression. def self.password_prompt(prompt="Password: ") sync = STDOUT.sync begin with_echo do STDOUT.sync = true print(prompt) STDIN.gets.chomp end ensure STDOUT.sync = sync puts end end def self.prompt(prompt="Password", default=nil) sync = STDOUT.sync begin STDOUT.sync = true print("#{prompt}") print " [#{default}]" if default print ': ' response = STDIN.gets.chomp response == '' ? default : response ensure STDOUT.sync = sync puts end end end end
Version data entries
4 entries across 4 versions & 1 rubygems