aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar jesopo2020-02-27 18:03:21 +0000
committerGravatar jesopo2020-02-27 18:03:21 +0000
commita4a28c779e04b0976f26c5c72c2aa0310aea8c67 (patch)
tree9df33f2382f0ca6072f98ea56ef0e3d71c63f028 /src
parentif there's more than 1 error message, give generic error (diff)
signature
show usage strings when spec parsing fails
Diffstat (limited to 'src')
-rw-r--r--src/core_modules/command_spec/__init__.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/core_modules/command_spec/__init__.py b/src/core_modules/command_spec/__init__.py
index 196afbd6..1fdd02a9 100644
--- a/src/core_modules/command_spec/__init__.py
+++ b/src/core_modules/command_spec/__init__.py
@@ -133,4 +133,16 @@ class Module(ModuleManager.BaseModule):
if count >= best_count:
overall_error = current_error
- return utils.consts.PERMISSION_HARD_FAIL, overall_error
+ error_out = overall_error
+
+ if event["is_channel"]:
+ context = utils.parse.SpecArgumentContext.CHANNEL
+ else:
+ context = utils.parse.SpecArgumentContext.PRIVATE
+ usages = " | ".join(
+ [utils.parse.argument_spec_human(s, context) for s in specs])
+
+ command = "%s%s" % (event["command_prefix"], event["command"])
+ error_out = "%s (Usage: %s)" % (overall_error, usages)
+
+ return utils.consts.PERMISSION_HARD_FAIL, error_out