aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar jesopo2018-10-03 17:01:26 +0100
committerGravatar jesopo2018-10-03 17:01:26 +0100
commit09b6f52d8ef6d875592c9a5aa1f42a228725a254 (patch)
treede866596ce1230bbcf0b02c4cff452d801c3ba1e
parentAdd 'remove_empty' kwarg for commands, to strip out empty space (diff)
signature
Fix showing usage when a user doesn't provide enough args to a command
-rw-r--r--modules/commands.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/modules/commands.py b/modules/commands.py
index fbe4eb23..f7390ad4 100644
--- a/modules/commands.py
+++ b/modules/commands.py
@@ -147,12 +147,13 @@ class Module(ModuleManager.BaseModule):
min_args = hook.kwargs.get("min_args")
if min_args and len(args_split) < min_args:
- if "usage" in hook.kwargs:
+ usage = self._get_usage(hook)
+ if usage:
stderr.write("Not enough arguments, usage: %s %s" % (
- command, hook.kwargs["usage"])).send()
+ command, usage)).send()
else:
- stderr.write("Not enough arguments (minimum: %d)" % min_args
- ).send()
+ stderr.write("Not enough arguments (minimum: %d)" %
+ min_args).send()
else:
args = " ".join(args_split)
server = event["server"]