Skip to content

Instantly share code, notes, and snippets.

@benhoskings
Created November 21, 2011 04:31
Show Gist options
  • Save benhoskings/1381621 to your computer and use it in GitHub Desktop.
Save benhoskings/1381621 to your computer and use it in GitHub Desktop.
require 'rb-fsevent'
LOG_CMD = 'git log --all --graph --pretty="format:%C(yellow)%h%Cblue%d%Creset %s %C(white) %an, %ar%Creset"'
abort("Run with a single argument (the directory to omglog).") unless ARGV.length == 1
FSEvent.new.tap {|fsevent|
lines = (`tput lines`.to_i * 0.8).floor
fsevent.watch(File.join(ARGV[0], '.git')) {|directories|
`#{LOG_CMD} -#{lines}`.tap {|log|
STDOUT.puts "\033[2J" + log
}
}
fsevent.run
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment