load, unload: prevent Traceback when not enough parameters are specified

Signed-off-by: Maxime Buquet's avatarMaxime “pep” Buquet <pep@bouah.net>
parent 5599838f
...@@ -1115,11 +1115,17 @@ class CommandCore: ...@@ -1115,11 +1115,17 @@ class CommandCore:
exc_info=True) exc_info=True)
@command_args_parser.quoted(1, 256) @command_args_parser.quoted(1, 256)
def load(self, args): def load(self, args: List[str]) -> None:
""" """
/load <plugin> [<otherplugin> …] /load <plugin> [<otherplugin> …]
# TODO: being able to load more than 256 plugins at once, hihi. # 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: for plugin in args:
self.core.plugin_manager.load(plugin) self.core.plugin_manager.load(plugin)
...@@ -1128,6 +1134,12 @@ class CommandCore: ...@@ -1128,6 +1134,12 @@ class CommandCore:
""" """
/unload <plugin> [<otherplugin> …] /unload <plugin> [<otherplugin> …]
""" """
usage = '/unload <plugin> [<otherplugin> …]'
if not args:
self.core.information(usage, 'Error')
return
for plugin in args: for plugin in args:
self.core.plugin_manager.unload(plugin) self.core.plugin_manager.unload(plugin)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment