fix HISTORY
This commit is contained in:
parent
423753feb4
commit
8d1f6519aa
1 changed files with 14 additions and 9 deletions
23
bin/rpl
23
bin/rpl
|
@ -22,17 +22,22 @@ class RplRepl
|
|||
|
||||
loop do
|
||||
input = Readline.readline( ' ', true )
|
||||
break if input.nil? || input == 'quit'
|
||||
|
||||
pp Readline::HISTORY if input == 'history'
|
||||
break if input.nil? || input.strip == 'quit'
|
||||
|
||||
# Remove blank lines from history
|
||||
Readline::HISTORY.pop if input.empty?
|
||||
|
||||
begin
|
||||
@interpreter.run( input )
|
||||
rescue ArgumentError => e
|
||||
pp e
|
||||
if input.strip == 'history'
|
||||
Readline::HISTORY.each do |line|
|
||||
pp line
|
||||
end
|
||||
elsif input.empty?
|
||||
# Remove blank lines from history
|
||||
Readline::HISTORY.pop
|
||||
else
|
||||
begin
|
||||
@interpreter.run( input )
|
||||
rescue ArgumentError => e
|
||||
pp e
|
||||
end
|
||||
end
|
||||
|
||||
print_stack
|
||||
|
|
Loading…
Add table
Reference in a new issue