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
|
# File 'lib/diary/cli/parser.rb', line 6
def parse(args)
options = OpenStruct.new
options.force = false
options.git = true
opts = OptionParser.new do |opts|
opts.banner = "Usage: diary ACTION [-vf]"
opts.separator "\nSpecific options:"
opts.on("-f", "--[no-]force", "Force all items to compile") do |force|
options.force = force
end
opts.on("-g", "--[no-]git", "Git init the repository.") do |git|
options.git = git
end
opts.separator "\nCommon options:"
opts.on_tail("-h", "--help", "Show this message") do
$stdout.puts opts
exit
end
opts.on_tail("-v", "--version", "Show version") do
$stdout.puts "diary #{VERSION}"
exit
end
end
opts.parse!(args)
options
end
|