lib/inch/cli/command/output/suggest.rb in inch-0.3.0.rc2 vs lib/inch/cli/command/output/suggest.rb in inch-0.3.0.rc3
- old
+ new
@@ -28,20 +28,24 @@
@relevant_objects = relevant_objects
@grade_lists = grade_lists
@files = files
if objects.empty?
- # TODO: show hint
+ display_no_objects_hint
else
display_list
display_files
display_distribution
end
end
private
+ def base_dir
+ "#{Dir.pwd}/"
+ end
+
def display_distribution
sparkline = grades_sparkline(@relevant_objects).to_s(' ')
puts "Grade distribution (undocumented, C, B, A): " + sparkline
puts
puts priority_filter_hint
@@ -60,12 +64,13 @@
def display_files
trace
trace "You might want to look at these files:"
trace
- files.each do |f|
- trace edged(FILE_COLOR, f.fullname.color(FILE_COLOR))
+ files.each do |file|
+ filename = file.fullname.gsub(base_dir, '')
+ trace edged(FILE_COLOR, filename.color(FILE_COLOR))
end
trace
end
def display_list
@@ -80,9 +85,18 @@
priority = o.priority
trace edged(r.color, " #{grade} #{priority_arrow(priority, r.color)} #{o.fullname}")
end
end
end
+ end
+
+ def display_no_objects_hint
+ hint = if @options.pedantic
+ "Even by my standards."
+ else
+ "Try --pedantic to be excessively concerned with minor details and rules."
+ end
+ trace "Nothing to suggest.".color(:green) + " #{hint}"
end
def min_priority_arrows
priority_arrows_gte(@options.object_min_priority).join(' ')
end