From 6e77c313b2b386eb46ca697c042daeecf68e1eae Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Wed, 9 Feb 2022 16:35:54 +0100 Subject: [PATCH] implement VERSION and UNAME --- lib/core/general.rb | 15 +++++++++++++++ repl.rb | 2 -- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/core/general.rb b/lib/core/general.rb index 939424a..799c137 100644 --- a/lib/core/general.rb +++ b/lib/core/general.rb @@ -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 diff --git a/repl.rb b/repl.rb index 31717f2..e2ed5ac 100644 --- a/repl.rb +++ b/repl.rb @@ -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?