12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/voca_buil/multi_check.rb', line 12
def self.parse(args = ARGV)
options = OPTIONS_DEFAULT.dup
options[:cmd_line] = args.join(' ') opt = ::OptionParser.new
opt.banner = "Usage: hc check [options]"
opt.on('-f FILE', '--file FILE', 'YAML file to use') do |v|
options[:file] = v
end
opt.on('-a NUM', '--answer NUM', Integer, 'Number of answer choices(def 5)') do |v|
options[:a_num] = v
end
opt.on('-q NUM', '--quiz NUM', Integer, 'Number of quiz(def 5)') do |v|
options[:w_num] = v
end
opt.on('-i [NUM]', '--iterative [NUM]', Integer, 'Test iteratively (num=2)') do |v|
options[:iter] = v.nil? ? 2 : v
end
opt.on('--install', 'Install sample check data') do
options[:install] = true
end
opt.on('-r', '--reverse', 'Reverse quiz and answers') do
options[:reverse] = true
end
opt.parse!(args)
p options
options
end
|