From 291db997c50bc7ff600cc312d7850470f22d7436 Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Tue, 15 Nov 2022 14:24:38 +0100 Subject: [PATCH] refine decision to launch repl; option to set verbosity Signed-off-by: Gwenhael Le Moine --- bin/rpl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/rpl b/bin/rpl index 4ee4b5e..8139356 100755 --- a/bin/rpl +++ b/bin/rpl @@ -85,7 +85,7 @@ def persistence_filename File.expand_path( "#{persistence_dir}/env.rpl" ) end -options = { run_REPL: ARGV.empty?, +options = { run_REPL: false, persistence: true, live_persistence: true, persistence_filename: persistence_filename, @@ -128,8 +128,18 @@ OptionParser.new do |opts| options[:run_REPL] = true end + + opts.on('-V', '--verbose "level"', 'set verbosity level') do |level| + options[:verbosity] = level.to_sym + + warn "Setting verbosity to #{level.to_sym}" if options[:verbosity] == :debug + end end.parse! +options[:run_REPL] = options[:files].empty? && options[:programs].empty? + +warn "Loading state #{options[:persistence_filename]}." if options[:verbosity] == :debug && !options[:persistence_filename].nil? + # Instantiate interpreter interpreter = Rpl.new( persistence_filename: options[:persistence_filename], live_persistence: options[:live_persistence] )