Created
June 15, 2017 14:24
-
-
Save ocadaruma/ad5803e6939e264f9e6f09208a3e3a20 to your computer and use it in GitHub Desktop.
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
| # Usage: | |
| ## cd /path/to/repository && ruby /path/to/repo_stat.rb | |
| files = `git grep --cached -Il ''`.chomp.split("\n") | |
| count_map = {} | |
| files.each do |file| | |
| ext = file.split(/[.\/]/).last | |
| count = `cat #{file.gsub(" ", "\\ ")} | wc -l | tr -d ' '`.chomp.to_i | |
| current = count_map[ext] || 0 | |
| count_map[ext] = current + count | |
| end | |
| count_map.sort_by { |k, v| -v }.each do |ext, count| | |
| puts "#{ext}\t#{count}" | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment