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:
parent
4735d145b6
commit
8f7fe39c27
1 changed files with 5 additions and 0 deletions
|
@ -43,6 +43,11 @@ class CommandArgs(list):
|
||||||
raise InvalidInputError("Pattern didn't match")
|
raise InvalidInputError("Pattern didn't match")
|
||||||
return match
|
return match
|
||||||
|
|
||||||
|
def optional(self, index: int) -> typing.Optional:
|
||||||
|
try:
|
||||||
|
return self[index]
|
||||||
|
except IndexError:
|
||||||
|
return None
|
||||||
|
|
||||||
class Command:
|
class Command:
|
||||||
"""A generic command, called from any source."""
|
"""A generic command, called from any source."""
|
||||||
|
|
Loading…
Reference in a new issue