module Net::SSH::PromptMethods::Clear

  1. lib/net/ssh/prompt.rb
Parent: PromptMethods

Defines the prompt method to use when neither Highline nor Termios are installed.

Methods

Public Instance

  1. prompt

Public Instance methods

prompt (prompt, echo=true)

Displays the prompt to $stdout and pulls the response from $stdin. Text is always echoed in the clear, regardless of the echo setting. The first time a prompt is given and echo is false, a warning will be written to $stderr recommending that either Highline or Termios be installed.

[show source]
# File lib/net/ssh/prompt.rb, line 64
def prompt(prompt, echo=true)
  @seen_warning ||= false
  if !echo && !@seen_warning
    $stderr.puts "Text will be echoed in the clear. Please install the HighLine or Termios libraries to suppress echoed text."
    @seen_warning = true
  end

  $stdout.print(prompt)
  $stdout.flush
  $stdin.gets.chomp
end