diff --git a/royalnet/utils/command.py b/royalnet/utils/command.py index 6b548d2e..84a26f8e 100644 --- a/royalnet/utils/command.py +++ b/royalnet/utils/command.py @@ -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."""