class BinlogReaderCommand::Base
Public Class Methods
new(argv = ARGV)
click to toggle source
# File lib/fluent/command/binlog_reader.rb, line 76 def initialize(argv = ARGV) @argv = argv @options = { plugin: [] } @opt_parser = OptionParser.new do |opt| opt.version = Fluent::VERSION opt.separator 'Options:' opt.on('-p DIR', '--plugin', 'add library directory path') do |v| @options[:plugin] << v end end end
Public Instance Methods
call()
click to toggle source
# File lib/fluent/command/binlog_reader.rb, line 90 def call raise NotImplementedError, 'BUG: command MUST implement this method' end
Private Instance Methods
parse_options!()
click to toggle source
# File lib/fluent/command/binlog_reader.rb, line 102 def parse_options! @opt_parser.parse!(@argv) unless @options[:plugin].empty? if dir = @options[:plugin].find { |d| !Dir.exist?(d) } usage "Directory #{dir} doesn't exist" else @options[:plugin].each do |d| Fluent::Plugin.add_plugin_dir(d) end end end rescue => e usage e end
usage(msg = nil)
click to toggle source
# File lib/fluent/command/binlog_reader.rb, line 96 def usage(msg = nil) puts @opt_parser.to_s puts "Error: #{msg}" if msg exit 1 end