fix HISTORY

This commit is contained in:
Gwenhael Le Moine 2022-10-05 09:56:12 +02:00
parent 423753feb4
commit 8d1f6519aa
No known key found for this signature in database
GPG key ID: FDFE3669426707A7

23
bin/rpl
View file

@ -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