For example, I was curious about all the places that define functions starting with lift:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pp' | |
ARGF.each_line do |line| | |
next unless line =~ /def lift/ | |
# def liftFnord[asdf]9) = | |
elements = / def lift(.*)=*/ | |
next if line =~ /lift[2-9]/ | |
next if line =~ /lift\d\d/ | |
the_function = "lift" + line.match(elements)[1] | |
fn_name, _ = the_function.split(/[\[(]/,2) | |
fname = File.basename ARGF.filename | |
puts "#{fname}\t#{fn_name}\t#{the_function}\t#{ARGF.lineno}\t#{line}" | |
end |
And then to read the output, I use a google spreadsheet:
Run with:
find * -name *.scala -type f -print0 | xargs -0 ruby lift.rb | pbcopy
pbcopy is the mac utility that copies stdout to the clipboard, so it's fast to run this from the command line, switch to the spreadsheet, and hit paste.