Sha256: 109636d9ffdf02d70d8073cae473e4c1b41d533d55b4678356ac9b169691ba43
Contents?: true
Size: 985 Bytes
Versions: 1
Compression:
Stored size: 985 Bytes
Contents
#!/usr/bin/env ruby require 'optparse' options = { :delimiter => "\t", :interval => 1, :mode => :stat } OptionParser.new(ARGV) {|opt| opt.banner = "tail -f access.log | #{$0} <OPTIONS>" opt.on('-f [num]', Integer, 'value field') {|v| options[:field] = v } opt.on('-k [num]', Integer, 'key field') {|v| options[:key] = v } opt.on('-d [delimiter]', String) {|v| options[:delimiter] = v } opt.on('-i [interval]', Integer, 'interval for stat mode') {|v| options[:interval] = v } opt.on('-e [filter]', String) {|v| options[:filter] = v } opt.on('--map [file]', String, 'mapping file') {|v| options[:map] = File.read(v) } opt.on('--stat', 'statistics mode (default)') { options[:mode] = :stat } opt.on('--print', 'print line mode') { options[:mode] = :print } }.parse! $: << File.expand_path('../../lib', __FILE__) require "tailstrom/command/#{options[:mode]}" cls = Module.const_get "Tailstrom::Command::#{options[:mode].capitalize}" cmd = cls.new options cmd.run
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tailstrom-0.0.4 | bin/tailstrom |