aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorGravatar jesopo2020-01-27 11:56:28 +0000
committerGravatar jesopo2020-01-27 11:57:23 +0000
commitd438b6dbc976ac1f840e0a7631629f1375b680b5 (patch)
tree39017f5d773ed9dbfb0bb58f1e3bbe6ddd66aa71 /src/utils
parentadd non-consuming spec arg types for privateonly and channelonly (diff)
signature
add "additional word" (`aword`) command arument spec type
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/parse/spec.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/utils/parse/spec.py b/src/utils/parse/spec.py
index 46ab9ad5..0fb25aca 100644
--- a/src/utils/parse/spec.py
+++ b/src/utils/parse/spec.py
@@ -1,5 +1,6 @@
import enum, typing
from .time import duration
+from . import try_int
class SpecArgumentContext(enum.IntFlag):
CHANNEL = 1
@@ -27,6 +28,11 @@ class SpecArgumentTypeWord(SpecArgumentType):
if args:
return args[0], 1
return None, 1
+class SpecArgumentTypeAdditionalWord(SpecArgumentType):
+ def simple(self, args: typing.List[str]) -> typing.Tuple[typing.Any, int]:
+ if len(args) > 1:
+ return args[0], 1
+ return None, 1
class SpecArgumentTypeWordLower(SpecArgumentTypeWord):
def simple(self, args: typing.List[str]) -> typing.Tuple[typing.Any, int]:
out = SpecArgumentTypeWord.simple(self, args)
@@ -58,6 +64,7 @@ class SpecArgumentPrivateType(SpecArgumentType):
SPEC_ARGUMENT_TYPES = {
"word": SpecArgumentTypeWord,
+ "aword": SpecArgumentTypeAdditionalWord,
"wordlower": SpecArgumentTypeWordLower,
"string": SpecArgumentTypeString,
"tstring": SpecArgumentTypeTrimString,