Skip to content

Commit

Permalink
Merge pull request #1 from markmcspadden/master
Browse files Browse the repository at this point in the history
Add depth + timestamps options to executable
  • Loading branch information
igrigorik committed Dec 15, 2011
2 parents e189242 + 4a02d01 commit 7521c92
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions bin/bugspots
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,34 @@ ARGV << '--help' if ARGV.empty?
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: bugspots /path/to/git/repo"

# Option: Set Depth
opts.on('-d', '--depth [depth]', 'depth of log crawl (integer)') do |d|
options[:depth] = d.to_i
end

# Option: Set Timestamp Display
opts.on('--display-timestamps', 'show timestamps of each identified fix commit') do |dt|
options[:display_timestamps] = true
end
end.parse!

# Set a reasonable default of depth
options[:depth] ||= 500

puts "Scanning #{ARGV[0]} repo".foreground(:green)

fixes, spots = Bugspots.scan(ARGV[0])
fixes, spots = Bugspots.scan(ARGV[0], options[:depth])

puts "\tFound #{fixes.size} bugfix commits, with #{spots.size} hotspots:".foreground(:yellow)
puts

puts "\tFixes:".foreground(:green).underline
fixes.each do |fix|
puts "\t\t- #{fix.message}".foreground(:yellow)
message = "\t\t- "
message << "#{fix.date} " if options[:display_timestamps]
message << "#{fix.message}"
puts message.foreground(:yellow)
end

puts "\n"
Expand Down

0 comments on commit 7521c92

Please sign in to comment.