]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
config core botmodule: bolden keys on search
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Wed, 23 Apr 2008 22:28:28 +0000 (00:28 +0200)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Wed, 23 Apr 2008 22:28:28 +0000 (00:28 +0200)
lib/rbot/core/config.rb

index de122dcd674981da8752f7b39dae1060dded50c1..439d7c5104c6cb0a212546ff980b05eeb28c6335 100644 (file)
@@ -72,13 +72,13 @@ class ConfigModule < CoreBotModule
     rx = Regexp.new(params[:rx].to_s, true)
     cfs = []
     @bot.config.items.each do |k, v|
-      cfs << v if k.to_s.match(rx) or (v.desc.match(rx) rescue false)
+      cfs << [Bold + k.to_s + Bold, v.desc] if k.to_s.match(rx) or (v.desc.match(rx) rescue false)
     end
     if cfs.empty?
       m.reply _("no config key found matching %{r}") % { :r => params[:rx].to_s}
     else
-      m.reply _("possible keys: %{kl}") % { :kl => cfs.map { |c| c.key}.join(', ') }
-      m.reply cfs.map { |c| [c.key, c.desc].join(': ') }.join("\n")
+      m.reply _("possible keys: %{kl}") % { :kl => cfs.map { |c| c.first}.join(', ') }
+      m.reply cfs.map { |c| c.join(': ') }.join("\n")
     end
   end