summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime “pep” Buquet <pep@bouah.net>2020-02-04 14:00:19 +0100
committerMaxime “pep” Buquet <pep@bouah.net>2020-02-04 14:00:19 +0100
commit412aeff6dc59c77f3d686de10f261d2a1ed67803 (patch)
tree492ed389f7ca7250e68efcdceae6bfefd7b4e8d8
parent5599838f4f1fdefb2443c041e25a111e8c39694a (diff)
downloadpoezio-412aeff6dc59c77f3d686de10f261d2a1ed67803.tar.gz
poezio-412aeff6dc59c77f3d686de10f261d2a1ed67803.tar.bz2
poezio-412aeff6dc59c77f3d686de10f261d2a1ed67803.tar.xz
poezio-412aeff6dc59c77f3d686de10f261d2a1ed67803.zip
load, unload: prevent Traceback when not enough parameters are specified
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
-rw-r--r--poezio/core/commands.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/poezio/core/commands.py b/poezio/core/commands.py
index 50bbca68..fca9a705 100644
--- a/poezio/core/commands.py
+++ b/poezio/core/commands.py
@@ -1115,11 +1115,17 @@ class CommandCore:
exc_info=True)
@command_args_parser.quoted(1, 256)
- def load(self, args):
+ def load(self, args: List[str]) -> None:
"""
/load <plugin> [<otherplugin> …]
# TODO: being able to load more than 256 plugins at once, hihi.
"""
+
+ usage = '/load <plugin> [<otherplugin> …]'
+ if not args:
+ self.core.information(usage, 'Error')
+ return
+
for plugin in args:
self.core.plugin_manager.load(plugin)
@@ -1128,6 +1134,12 @@ class CommandCore:
"""
/unload <plugin> [<otherplugin> …]
"""
+
+ usage = '/unload <plugin> [<otherplugin> …]'
+ if not args:
+ self.core.information(usage, 'Error')
+ return
+
for plugin in args:
self.core.plugin_manager.unload(plugin)