summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugin.py3
-rw-r--r--src/plugin_manager.py6
2 files changed, 9 insertions, 0 deletions
diff --git a/src/plugin.py b/src/plugin.py
index a5aae1f6..8d873419 100644
--- a/src/plugin.py
+++ b/src/plugin.py
@@ -74,6 +74,9 @@ class BasePlugin(object, metaclass=SafetyMetaclass):
def add_command(self, name, handler, help, completion=None):
return self.plugin_manager.add_command(self.__module__, name, handler, help, completion)
+ def del_command(self, name):
+ return self.plugin_manager.del_command(self.__module__, name)
+
def add_event_handler(self, event_name, handler):
return self.plugin_manager.add_event_handler(self.__module__, event_name, handler)
diff --git a/src/plugin_manager.py b/src/plugin_manager.py
index 82be8632..5bd6d75b 100644
--- a/src/plugin_manager.py
+++ b/src/plugin_manager.py
@@ -81,6 +81,12 @@ class PluginManager(object):
import traceback
self.core.information(_("Could not unload plugin (may not be safe to try again): ") + traceback.format_exc())
+ def del_command(self, module_name, name):
+ if name in self.commands[module_name]:
+ del self.commands[module_name][name]
+ if name in self.core.commands:
+ del self.core.commands[name]
+
def add_command(self, module_name, name, handler, help, completion=None):
if name in self.core.commands:
raise Exception(_("Command '%s' already exists") % (name,))