class Thor::LineEditor::Readline
def self.available?
def self.available? Object.const_defined?(:Readline) end
def add_to_history?
def add_to_history? options.fetch(:add_to_history, true) end
def completion_options
def completion_options options.fetch(:limited_to, []) end
def completion_proc
def completion_proc if use_path_completion? Proc.new { |text| PathCompletion.new(text).matches } elsif completion_options.any? Proc.new do |text| completion_options.select { |option| option.start_with?(text) } end end end
def readline
def readline if echo? ::Readline.completion_append_character = nil # Ruby 1.8.7 does not allow Readline.completion_proc= to receive nil. if complete = completion_proc ::Readline.completion_proc = complete end ::Readline.readline(prompt, add_to_history?) else super end end
def use_path_completion?
def use_path_completion? options.fetch(:path, false) end