Created
March 20, 2012 22:07
-
-
Save NilsHaldenwang/2141763 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env ruby | |
# -*- encoding: UTF-8 -*- | |
changed_files = insertions = deletions = 0 | |
cmd = nil | |
default_log_cmd = 'git log --since="00:00:01am" --stat -- .' | |
complete_log_cmd = 'git log --pretty=medium --stat -- .' | |
unless ARGV[0] | |
puts "No time given. Using default: today in current folder." | |
cmd = default_log_cmd | |
else | |
if ARGV[0] == "all" | |
puts "Showing all changes in the current folder." | |
cmd = complete_log_cmd | |
else | |
cmd = ARGV[0] | |
end | |
end | |
puts cmd | |
lines = `#{cmd}` | |
lines.each_line do |line| | |
if line =~ /(\d+) files changed, (\d+) insertions\(\+\), (\d+) deletions\(-\)/ | |
changed_files += $1.to_i | |
insertions += $2.to_i | |
deletions += $3.to_i | |
end | |
end | |
puts "#{changed_files} files changed, #{insertions} insertions(+), #{deletions} deletions(-) (#{insertions + deletions} changes)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment