refine decision to launch repl; option to set verbosity

Signed-off-by: Gwenhael Le Moine <gwenhael.le.moine@gmail.com>
This commit is contained in:
Gwenhael Le Moine 2022-11-15 14:24:38 +01:00
parent e43eaff903
commit 291db997c5
No known key found for this signature in database
GPG key ID: FDFE3669426707A7

12
bin/rpl
View file

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