class Pry::REPL

def read_line(current_prompt)

Returns:
  • (String?) - The next line of input, or `nil` on .

Parameters:
  • current_prompt (String) -- The prompt to use for input.
def read_line(current_prompt)
  handle_read_errors do
    if coolline_available?
      input.completion_proc = proc do |cool|
        completions = @pry.complete cool.completed_word
        completions.compact
      end
    elsif input.respond_to? :completion_proc=
      input.completion_proc = proc do |inp|
        @pry.complete inp
      end
    end
    if reline_available?
      Reline.output_modifier_proc = lambda do |text, _|
        if pry.color
          SyntaxHighlighter.highlight(text)
        else
          text
        end
      end
      if pry.config.auto_indent
        Reline.auto_indent_proc = lambda do |lines, line_index, _byte_ptr, _newline|
          if line_index == 0
            0
          else
            pry_indentation = Pry::Indent.new
            pry_indentation.indent(lines.join("\n"))
            pry_indentation.last_indent_level.length
          end
        end
      end
    end
    if input_multiline?
      input_readmultiline(current_prompt, false)
    elsif readline_available?
      set_readline_output
      input_readline(current_prompt, false) # false since we'll add it manually
    elsif coolline_available?
      input_readline(current_prompt)
    elsif input.method(:readline).arity == 1
      input_readline(current_prompt)
    else
      input_readline
    end
  end
end