20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/logpoop.rb', line 20
def self.parse_options
options = {
:type => :tail,
:log_dir => "/var/log"
}
o = OptionParser.new do |opt|
opt.banner = self.banner
opt.on("-v", "--version", "Show version") do
puts File.read(File.join(File.dirname(__FILE__), '..', 'VERSION'))
exit
end
opt.on("-d", "--log_dir DIRECTORY", "Log directory") do |d|
options[:log_dir] = d
end
opt.on("-t", "--type TYPE", "Poop type. Available types:\n\tpoop - take a dump in your terminal\n\ttail - simulate 'tail -f' in all your open terminals\n\ttest - simulate a console test run (needs two terminals open)\n\tmake - simulate compiling something for a long, long, looooong time") do |t|
options[:type] = t
end
end
o.parse!
options
end
|