HISTORY pushes the history on the stack as a list

This commit is contained in:
Gwenhael Le Moine 2022-10-11 13:32:19 +02:00
parent 0d07d0e0dd
commit d54bebdcec
No known key found for this signature in database
GPG key ID: FDFE3669426707A7

View file

@ -46,12 +46,10 @@ class RplRepl
if input.strip == 'edit'
prefill = @interpreter.stack.pop.to_s
elsif input.strip == 'history'
Readline::HISTORY.each do |line|
pp line
end
@interpreter.run( "{ #{Reline::HISTORY.map { |line| "\"#{line}\"" }.join(' ')} }" )
elsif input.empty?
# Remove blank lines from history
Readline::HISTORY.pop
Reline::HISTORY.pop
else
begin
@interpreter.run( input )