diff options
Diffstat (limited to 'src/utils/parse/spec.py')
| -rw-r--r-- | src/utils/parse/spec.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/utils/parse/spec.py b/src/utils/parse/spec.py index 0fb25aca..a52dc969 100644 --- a/src/utils/parse/spec.py +++ b/src/utils/parse/spec.py @@ -1,6 +1,6 @@ import enum, typing from .time import duration -from . import try_int +from .types import try_int class SpecArgumentContext(enum.IntFlag): CHANNEL = 1 @@ -49,6 +49,12 @@ class SpecArgumentTypeTrimString(SpecArgumentTypeString): def simple(self, args: typing.List[str]): return SpecArgumentTypeString.simple(self, list(filter(None, args))) +class SpecArgumentTypeInt(SpecArgumentType): + def simple(self, args): + if args: + return try_int(args[0]), 1 + return None, 1 + class SpecArgumentTypeDuration(SpecArgumentType): def name(self): return "+%s" % (SpecArgumentType.name(self) or "duration") @@ -68,6 +74,7 @@ SPEC_ARGUMENT_TYPES = { "wordlower": SpecArgumentTypeWordLower, "string": SpecArgumentTypeString, "tstring": SpecArgumentTypeTrimString, + "int": SpecArgumentTypeInt, "duration": SpecArgumentTypeDuration } |
