blob: c3950ca3843eebc3732e760bf7a4e6d7a4424fff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
require 'optparse'
module RCM
# Command line options
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)
def option(key)
raise "No such option: #{key}" unless @@options.key?(key)
@@options[key]
end
end
end
|