[commands] Properly handle typing.Optional as last positional parameter
This commit is contained in:
parent
7fbdc6e83f
commit
0513ea1f53
@ -413,6 +413,8 @@ class Command(_BaseCommand):
|
|||||||
if param.kind == param.VAR_POSITIONAL:
|
if param.kind == param.VAR_POSITIONAL:
|
||||||
raise RuntimeError() # break the loop
|
raise RuntimeError() # break the loop
|
||||||
if required:
|
if required:
|
||||||
|
if self._is_typing_optional(param.annotation):
|
||||||
|
return None
|
||||||
raise MissingRequiredArgument(param)
|
raise MissingRequiredArgument(param)
|
||||||
return param.default
|
return param.default
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user