1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Add optional to CommandArgs

This commit is contained in:
Steffo 2019-04-09 12:17:05 +02:00
parent 4735d145b6
commit 8f7fe39c27

View file

@ -43,6 +43,11 @@ class CommandArgs(list):
raise InvalidInputError("Pattern didn't match")
return match
def optional(self, index: int) -> typing.Optional:
try:
return self[index]
except IndexError:
return None
class Command:
"""A generic command, called from any source."""