Fix showing usage when a user doesn't provide enough args to a command
This commit is contained in:
parent
02e76444d1
commit
09b6f52d8e
1 changed files with 5 additions and 4 deletions
|
@ -147,12 +147,13 @@ class Module(ModuleManager.BaseModule):
|
||||||
|
|
||||||
min_args = hook.kwargs.get("min_args")
|
min_args = hook.kwargs.get("min_args")
|
||||||
if min_args and len(args_split) < 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" % (
|
stderr.write("Not enough arguments, usage: %s %s" % (
|
||||||
command, hook.kwargs["usage"])).send()
|
command, usage)).send()
|
||||||
else:
|
else:
|
||||||
stderr.write("Not enough arguments (minimum: %d)" % min_args
|
stderr.write("Not enough arguments (minimum: %d)" %
|
||||||
).send()
|
min_args).send()
|
||||||
else:
|
else:
|
||||||
args = " ".join(args_split)
|
args = " ".join(args_split)
|
||||||
server = event["server"]
|
server = event["server"]
|
||||||
|
|
Loading…
Reference in a new issue