Sha256: adf3b44b8fee65a024016cc7fd74474d218be060e15fbcaef3025527a7280db2

Contents?: true

Size: 419 Bytes

Versions: 13

Compression:

Stored size: 419 Bytes

Contents

#!/usr/bin/env ruby
# A poor man's pager... :)

require 'file/tail'

filename = ARGV.shift or fail "Usage: #$0 filename [height]"
height = (ARGV.shift || ENV['LINES'] || 23).to_i - 1

File::Tail::Logfile.open(filename, :break_if_eof => true) do |log|
  begin
    log.tail(height) { |line| puts line }
    print "Press return key to continue!" ; gets
    print ""
    redo
  rescue File::Tail::BreakException
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
file-tail-1.3.0 examples/pager.rb
file-tail-1.2.0 examples/pager.rb
file-tail-1.1.1 examples/pager.rb
file-tail-1.1.0 examples/pager.rb
file-tail-1.0.12 examples/pager.rb
file-tail-1.0.11 examples/pager.rb
file-tail-1.0.10 examples/pager.rb
file-tail-1.0.9 examples/pager.rb
file-tail-1.0.8 examples/pager.rb
file-tail-1.0.7 examples/pager.rb
file-tail-1.0.6 examples/pager.rb
file-tail-1.0.5 examples/pager.rb
file-tail-1.0.4 examples/pager.rb