Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1 from markmcspadden/master

Add depth + timestamps options to executable
  • Loading branch information...
commit 7521c9283c3883b6d56087e2378f2bf2fa39305f 2 parents e189242 + 4a02d01
Ilya Grigorik authored
Showing with 18 additions and 2 deletions.
  1. +18 −2 bin/bugspots
20 bin/bugspots
View
@@ -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"
Please sign in to comment.
Something went wrong with that request. Please try again.