implement VERSION and UNAME

This commit is contained in:
Gwenhael Le Moine 2022-02-09 16:35:54 +01:00
parent 717e04549e
commit 6e77c313b2
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
2 changed files with 15 additions and 2 deletions

View file

@ -9,6 +9,21 @@ module Rpl
def nop( stack, dictionary )
[stack, dictionary]
end
# show version
def version( stack, dictionary )
stack += Rpl::Interpreter.parse( Rpl::Lang.version.to_s )
[stack, dictionary]
end
# show complete identification string
def uname( stack, dictionary )
stack += Rpl::Interpreter.parse( "\"Rpl Interpreter version #{Rpl::Lang.version}\"" )
[stack, dictionary]
end
end
end
end

View file

@ -21,8 +21,6 @@ class RplRepl
pp Readline::HISTORY if input == 'history'
input = '"rpn.rb version 0.0"' if %w[version uname].include?( input )
# Remove blank lines from history
Readline::HISTORY.pop if input.empty?