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
|
# File 'lib/grepity/option.rb', line 5
def self.parse
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: #{$0} text file [OPTIONS]"
opts.on('-i', '--ignorecase', 'ignore case sensivity') do
options[:ignorecase] = Regexp::IGNORECASE
end
opts.on('-w', '--word', 'match only full word') do
options[:word] = true
end
opts.on('-l', '--line', 'show line numbers') do
options[:line] = true
end
opts.on_tail('-h', '--help', 'Help screen') do
puts opts
exit
end
end.parse!
options
end
|