.append() doesn't work on dict, use same code for missing optional
This commit is contained in:
parent
e26d8c5536
commit
2f5e2a8345
1 changed files with 10 additions and 10 deletions
|
@ -101,7 +101,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
current_error = error
|
current_error = error
|
||||||
elif n > len(args):
|
elif n > len(args):
|
||||||
current_error = "Not enough arguments"
|
current_error = "Not enough arguments"
|
||||||
return [None, -1, current_error or "Invalid arguments"]
|
return [argument_type, -1, current_error or "Invalid arguments"]
|
||||||
|
|
||||||
@utils.hook("preprocess.command")
|
@utils.hook("preprocess.command")
|
||||||
@utils.kwarg("priority", EventManager.PRIORITY_HIGH)
|
@utils.kwarg("priority", EventManager.PRIORITY_HIGH)
|
||||||
|
@ -129,7 +129,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
spec_argument.types, args)
|
spec_argument.types, args)
|
||||||
|
|
||||||
argument_type, n, value = self._argument_types(options, args)
|
argument_type, n, value = self._argument_types(options, args)
|
||||||
if not argument_type == None:
|
if n > -1:
|
||||||
args = args[n:]
|
args = args[n:]
|
||||||
|
|
||||||
if argument_type.exported:
|
if argument_type.exported:
|
||||||
|
@ -138,17 +138,17 @@ class Module(ModuleManager.BaseModule):
|
||||||
if argument_type_multi:
|
if argument_type_multi:
|
||||||
value = [argument_type.type, value]
|
value = [argument_type.type, value]
|
||||||
|
|
||||||
out[i] = value
|
elif not spec_argument.optional:
|
||||||
argument_type_name = argument_type.name()
|
|
||||||
if argument_type_name:
|
|
||||||
out[argument_type_name] = value
|
|
||||||
|
|
||||||
elif spec_argument.optional:
|
|
||||||
out.append(None)
|
|
||||||
else:
|
|
||||||
failed = True
|
failed = True
|
||||||
current_error = value
|
current_error = value
|
||||||
break
|
break
|
||||||
|
else:
|
||||||
|
value = None
|
||||||
|
|
||||||
|
out[i] = value
|
||||||
|
argument_type_name = argument_type.name()
|
||||||
|
if argument_type_name:
|
||||||
|
out[argument_type_name] = value
|
||||||
|
|
||||||
if not failed:
|
if not failed:
|
||||||
kwargs["spec"] = out
|
kwargs["spec"] = out
|
||||||
|
|
Loading…
Reference in a new issue