diff options
author | Dmitry Kim <dmitry point kim at gmail point com> | 2007-03-20 01:14:35 +0000 |
---|---|---|
committer | Dmitry Kim <dmitry point kim at gmail point com> | 2007-03-20 01:14:35 +0000 |
commit | b3004a38f1944376c470d4f5b61b1a0761e405be (patch) | |
tree | a935412d7e7f0fed8fec513e136076b3513547a7 /lib | |
parent | 4cd6bc945574015c92ba67b8dd661f01d7b0eb69 (diff) |
* tidying up 'help ignored plugins' output
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rbot/plugins.rb | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/rbot/plugins.rb b/lib/rbot/plugins.rb index 80ac2f1c..7b476da9 100644 --- a/lib/rbot/plugins.rb +++ b/lib/rbot/plugins.rb @@ -531,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 |