Skip to content

Instantly share code, notes, and snippets.

@drbig
Created December 8, 2014 12:50
Show Gist options
  • Save drbig/5d6f806fe015aa5da7dc to your computer and use it in GitHub Desktop.
Save drbig/5d6f806fe015aa5da7dc to your computer and use it in GitHub Desktop.
Pipe compiler errors to it.
#!/usr/bin/env ruby
# coding: utf-8
require 'smart_colored'
STDIN.each_line do |l|
if m = l.match(%r{((/.*?)+)\:(\d+)})
fn, _, ln = m.captures
next unless File.exist? fn
ln = ln.to_i
puts m.to_s.colored.bold
system "cat #{fn} | head -n#{ln+1} | tail -n#{3}"
print "\n"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment