Class: ExecRemote::Shell

Inherits:
Object
  • Object
show all
Defined in:
lib/exec_remote/shell.rb

Defined Under Namespace

Classes: ReadlineFallback

Instance Method Summary collapse

Instance Method Details

#read_lineObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/exec_remote/shell.rb', line 22

def read_line
  loop do
    command = reader.readline("> ")

    if command.nil?
      command = "exit"
    else
      command.strip!
    end

    unless command.empty?
      reader::HISTORY << command
      return command
    end
  end
end

#readerObject



13
14
15
16
17
18
19
20
# File 'lib/exec_remote/shell.rb', line 13

def reader
  @reader ||= begin
    require 'readline'
    Readline
  rescue LoadError
    ReadlineFallback
  end
end