5
6
7
8
9
10
11
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
41
42
43
44
45
|
# File 'lib/diary/cli.rb', line 5
def self.parse(args)
options = OpenStruct.new
options.verbose = false
options.force = false
opts = OptionParser.new do |opts|
opts.banner = "Usage: diary ACTION [-vf]"
opts.separator "\nSpecific options:"
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
options.verbose = v
end
opts.on("-f", "--[no-]force", "Force all items to compile") do |f|
options.force = f
end
opts.separator "\nCommon options:"
opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end
opts.on_tail("--version", "Show version") do
puts "diary #{Diary.version}"
exit
end
end
opts.parse!(args)
options
end
|