X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=lib%2Frbot%2Fplugins.rb;h=7b476da93a5819bdbfb359a5e9c73a8d99aa8a77;hb=c513b0227a88b441500581cff9e7f3f954830d2e;hp=7667ff84a6ccf6b549c9bba0a96ec79ebf6b1775;hpb=0cb6065efddab6726fe778303802850ba5de08ee;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/lib/rbot/plugins.rb b/lib/rbot/plugins.rb index 7667ff84..7b476da9 100644 --- a/lib/rbot/plugins.rb +++ b/lib/rbot/plugins.rb @@ -499,13 +499,14 @@ module Plugins list << "; #{Reverse}#{@failed.length} plugin#{'s' if @failed.length > 1} failed to load#{Reverse}" list << ": use #{Bold}help failed plugins#{Bold} to see why" unless short end - @failures_shown = true list end # return list of help topics (plugin names) def helptopics - return status + rv = status + @failures_shown = true + rv end def length @@ -530,15 +531,19 @@ module Plugins }.join("\n") when /ignored?\s*plugins?/ return "no plugins were ignored" if @ignored.empty? - return @ignored.inject(Array.new) { |list, p| - case p[:reason] - when :loaded - list << "#{p[:name]} in #{p[:dir]} (overruled by previous)" - else - list << "#{p[:name]} in #{p[:dir]} (#{p[:reason].to_s})" - end - list - }.join(", ") + + tmp = Hash.new + @ignored.each do |p| + reason = p[:loaded] ? 'overruled by previous' : p[:reason].to_s + ((tmp[p[:dir]] ||= Hash.new)[reason] ||= Array.new).push(p[:name]) + end + + return tmp.map do |dir, reasons| + s = reasons.map { |r, list| + list.map { |_| _.sub(/\.rb$/, '') }.join(', ') + " (#{r})" + }.join('; ') + "in #{dir}: #{s}" + end.join('; ') when /^(\S+)\s*(.*)$/ key = $1 params = $2