aboutsummaryrefslogtreecommitdiff
path: root/modules/help.py
diff options
context:
space:
mode:
Diffstat (limited to 'modules/help.py')
-rw-r--r--modules/help.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/modules/help.py b/modules/help.py
index 4ebd2a2a..bb3924c8 100644
--- a/modules/help.py
+++ b/modules/help.py
@@ -84,3 +84,19 @@ class Module(ModuleManager.BaseModule):
event["stdout"].write("Commands for %s module: %s" % (
module.name, ", ".join(commands)))
+
+ @utils.hook("received.command.apropos")
+ @utils.kwarg("min_args", 1)
+ @utils.kwarg("help", "Show commands with a given string in them")
+ @utils.kwarg("usage", "<query>")
+ def apropos(self, event):
+ query = event["args_split"][0]
+ query_lower = query.lower()
+
+ commands = []
+ for command, hook in self._all_command_hooks().items():
+ if query_lower in command.lower():
+ commands.append("%s%s" % (event["command_prefix"], command))
+ if commands:
+ event["stdout"].write("Apropos of '%s': %s" %
+ (query, ", ".join(commands)))