15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/flumtter/app/core/initializer.rb', line 15
def optparse
opt = OptionParser.new
opt.version = Flumtter::VERSION
options = {}
opt.on('-n VALUE', '--name VALUE', 'account name'){|v|options[:name] = v}
opt.on('-i VALUE', '--index VALUE', 'account index'){|v|options[:id] = v.to_i}
opt.on('-s', '--non_stream', 'without stream'){|v|options[:non_stream] = v}
opt.on('-d', '--debug', 'debug mode'){|v|options[:debug] = v}
opt.on('--args VALUE'){|v|options[:args] = v}
@args.each{|args|args.call(opt, options)}
opt.parse!(ARGV)
options.each{|k,v|@events[k].call(v,options) unless @events[k].nil?}
options
rescue OptionParser::InvalidOption => e
STDERR.puts e.message
exit false
end
|