diff options
| author | Paul Buetow <paul@buetow.org> | 2025-02-14 21:35:40 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-02-14 21:35:40 +0200 |
| commit | a2edd9ec657dca835ce1a73807a86a9c44fdfec8 (patch) | |
| tree | 678076fbd778b10264ed0b23857c8e5accdcc693 /lib/options.rb | |
| parent | 07e5f8d4402346ccb336cc0680cad98d0d5ba920 (diff) | |
initial tests
Diffstat (limited to 'lib/options.rb')
| -rw-r--r-- | lib/options.rb | 12 |
1 files changed, 6 insertions, 6 deletions
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) |
