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
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/jekyll-liquid-debug.rb', line 8
def self.parse(options)
args = {file:false, html:false, kmd:false, outhtml:false, outmd:false}
OptionParser.new do |opt|
opt.banner = "Usage: jekyll-liquid-debug [options]"
opt.separator ""
opt.separator "Input files:"
opt.on("-f", "--file [FILE]", String, "input liquid template") do |v|
args[:file] = Parser.func_set_file(v)
end
opt.on("-t", "--html [FILE]", String, "input html template") do |v|
args[:html] = Parser.func_set_file(v)
end
opt.on("-k", "--md [FILE]", String, "input raw markdown file, precedent for option `-t'") do |v|
args[:kmd] = Parser.func_set_file(v)
end
opt.on("--out-html", TrueClass, "output html file, overwrite may happen") do |v|
args[:outhtml] = true
end
opt.on("--out-md", TrueClass, "output markdown file, overwrite may happen") do |v|
args[:outmd] = true
end
opt.separator ""
opt.separator "Common options:"
opt.on_tail("-h", "--help", "Show help message") do
puts opt
exit
end
opt.on_tail("-v", "--version", "Show version") do
puts "Version #{VERSION}"
exit
end
opt.on_tail("--feature", "Show development feature") do
FEATURE.each { |x| puts x }
exit
end
end.parse!(options)
return args
end
|