Class: LSL::Shell

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#last_executionObject

Returns the value of attribute last_execution.



118
119
120
# File 'lib/lsl/shell.rb', line 118

def last_execution
  @last_execution
end

Instance Method Details

#get_inputObject



124
125
126
127
128
# File 'lib/lsl/shell.rb', line 124

def get_input
  #STDIN.gets.strip
  require 'readline'
  Readline.readline("#{Dir.getwd}> ",true).strip
end

#run(str) ⇒ Object



121
122
123
# File 'lib/lsl/shell.rb', line 121

def run(str)
  self.last_execution = LSL::CommandExecution::Compound.new(:command_str => str, :shell => self).tap { |x| x.run! }
end

#run_loopObject



129
130
131
132
133
134
135
# File 'lib/lsl/shell.rb', line 129

def run_loop
  loop do
    str = get_input
    run(str)
    last_execution.print!
  end
end