class HighLine::Terminal

def readline_read(question, highline)

Parameters:
  • question (HighLine::Question) -- question from where to get
def readline_read(question, highline)
  # prep auto-completion
  unless question.selection.empty?
    Reline.completion_proc = lambda do |str|
      question.selection.grep(/\A#{Regexp.escape(str)}/)
    end
  end
  # TODO: Check if this is still needed after Reline
  # work-around ugly readline() warnings
  old_verbose = $VERBOSE
  $VERBOSE    = nil
  raw_answer  = run_preserving_stty do
    prompt = highline.render_and_ident_statement(question)
    Reline.readline(prompt, true)
  end
  $VERBOSE = old_verbose
  raw_answer
end