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
46
|
# File 'lib/SitemapMaker/utils.rb', line 6
def option_parser args
args << '-h' if args.empty?
options = {}
optparse = OptionParser.new do |opts|
opts.banner = get_banner.gsub(/^\s*/, '')
opts.on('-h','--help','HELP') do
puts opts
exit
end
opts.on('-l', '--deep_level VAL', 'deep_level') do |l|
options[:level] = l
options[:level] ||= SitemapMaker::Utils::DEFAULT_LEVEL
end
opts.on('-f VAL', '--filepath VAL', 'output path') do |l|
options[:path] = l
end
opts.on('-t VAL', '--target VAL', 'target url') do |l|
options[:target] = l
end
opts.on('-v', '--version', 'Version') do
puts SitemapMaker::VERSION
exit
end
end
optparse.parse! args
options[:files] = args.to_a
{
level: options[:level],
path: options[:path],
target: options[:target],
}
end
|