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/watnow/option_parser.rb', line 7
def self.parse(args)
options = {}
options[:directory] = '.'
opts = OptionParser.new('', 24, ' ') do |opts|
opts.separator ' Usage: watnow [options]'
opts.separator ''
opts.on('-h', '--help', 'show this message') do
puts opts
exit
end
opts.on('-v', '--version', 'display version') do
puts VERSION
exit
end
opts.on('-d', '--directory DIR', 'directory DIR to scan (defaults: ./)') do |d|
options[:directory] = d
end
opts.separator ''
opts.separator ' watnow commands:'
opts.separator ' open <ID> open annotation ID in your editor'
opts.separator ' remove <ID> remove annotation ID'
options[:open] = get_option_value('open', args)
options[:remove] = get_option_value('remove', args)
end
opts.parse!(args)
options
end
|