support !... as "one or more", show "not enough args" error
This commit is contained in:
parent
1d9621022c
commit
264e544ce5
1 changed files with 13 additions and 7 deletions
|
@ -83,12 +83,14 @@ class Module(ModuleManager.BaseModule):
|
|||
chunk = server.get_user(args[0])
|
||||
n = 1
|
||||
error = "Unknown nickname"
|
||||
elif spec_type == "word" and args:
|
||||
chunk = args[0]
|
||||
elif spec_type == "word":
|
||||
if args:
|
||||
chunk = args[0]
|
||||
n = 1
|
||||
elif spec_type == "...":
|
||||
chunk = " ".join(args)
|
||||
n = len(args)
|
||||
if args:
|
||||
chunk = " ".join(args)
|
||||
n = max(1, len(args))
|
||||
|
||||
options.append([chunk, n, error])
|
||||
return options
|
||||
|
@ -122,10 +124,8 @@ class Module(ModuleManager.BaseModule):
|
|||
spec_type = spec_types[i]
|
||||
raw_spec_type = raw_spec_types[i]
|
||||
|
||||
if error and not first_error:
|
||||
first_error = error
|
||||
|
||||
if chunk:
|
||||
if not chunk == None:
|
||||
if "~" in raw_spec_type:
|
||||
kwargs[raw_spec_type.split("~", 1)[1]] = chunk
|
||||
|
||||
|
@ -135,6 +135,12 @@ class Module(ModuleManager.BaseModule):
|
|||
chunk = [spec_type, chunk]
|
||||
found = chunk
|
||||
break
|
||||
elif not error and n > 0:
|
||||
error = "Not enough arguments"
|
||||
|
||||
if error and not first_error:
|
||||
first_error = error
|
||||
|
||||
out.append(found)
|
||||
|
||||
if not optional and not found:
|
||||
|
|
Loading…
Reference in a new issue