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
30
31
32
|
# File 'lib/eventhub/argument_parser.rb', line 5
def self.parse(args)
options = OpenStruct.new
options.environment = 'development'
options.detached = false
opt_parser = OptionParser.new do |opts|
opts.banner = "Usage: #{args[0]}.rb [options]"
yield(opts, options) if block_given?
opts.on("-e", "--environment ENVIRONMENT","Environment the processor is running") do |environment|
options.environment = environment
end
opts.on("-d", "--detached", "Run processor detached as a daemon") do |v|
options.detached = v
end
opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end
end
opt_parser.parse!(args)
options
end
|