From a2edd9ec657dca835ce1a73807a86a9c44fdfec8 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 14 Feb 2025 21:35:40 +0200 Subject: initial tests --- lib/options.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/options.rb') diff --git a/lib/options.rb b/lib/options.rb index 79e3c51..ee30295 100644 --- a/lib/options.rb +++ b/lib/options.rb @@ -5,12 +5,12 @@ module RCM module Options @@options = { debug: false } - after_double_dash = ARGV.slice_before('--').to_a.last.drop(1) - - OptionParser.new do |opts| - opts.banner = 'Usage: rake [task] -- [options]' - opts.on('-v', '--[no-]debug', 'debug output') { |v| @@options[:debug] = v } - end.parse!(after_double_dash) + if (after_double_dash = ARGV.slice_before('--').to_a.last&.drop(1)) + OptionParser.new do |opts| + opts.banner = 'Usage: rake [task] -- [options]' + opts.on('-v', '--[no-]debug', 'debug output') { |v| @@options[:debug] = v } + end.parse!(after_double_dash) + end def option(key) raise "No such option: #{key}" unless @@options.key?(key) -- cgit v1.2.3