class RailsLogDeinterleaver::Cli

Public Class Methods

new() click to toggle source
# File lib/rails_log_deinterleaver/cli.rb, line 5
def initialize
  opts = Trollop::options do
    opt :output, "Output file (if unspecified, output will go to stdout)", type: :string
    opt :backward, "Limit how many lines to go backward (default: no limit)", type: :integer
  end
  input = ARGV.last
  if opts[:output]
    opts[:output] = File.new(opts[:output], 'w')
  end
  raise 'Must specify input log file' unless input && File.exist?(input)

  Parser.new(input, opts).run
end