aboutsummaryrefslogtreecommitdiff
path: root/src/utils/parse
diff options
context:
space:
mode:
authorGravatar jesopo2020-02-05 16:32:41 +0000
committerGravatar jesopo2020-02-05 16:32:41 +0000
commit460cda87bb1c0eae30479a1da40c732b0f38d767 (patch)
treed0810fc764b63b934adc58fd98e610bf2404d017 /src/utils/parse
parentrefactor -b/-q/-m timer logic in to 1 function (diff)
signature
add command spec type "words" - array of remaining words
Diffstat (limited to 'src/utils/parse')
-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 1aa24610..1cccd9eb 100644
--- a/src/utils/parse/spec.py
+++ b/src/utils/parse/spec.py
@@ -51,6 +51,12 @@ class SpecArgumentTypeString(SpecArgumentType):
class SpecArgumentTypeTrimString(SpecArgumentTypeString):
def simple(self, args: typing.List[str]):
return SpecArgumentTypeString.simple(self, list(filter(None, args)))
+class SpecArgumentTypeWords(SpecArgumentTypeString):
+ def simple(self, args: typing.List[str]):
+ if args:
+ out = list(filter(None, args))
+ return out, len(out)
+ return None, 1
class SpecArgumentTypeInt(SpecArgumentType):
def simple(self, args):
@@ -84,6 +90,7 @@ SPEC_ARGUMENT_TYPES = {
"aword": SpecArgumentTypeAdditionalWord,
"wordlower": SpecArgumentTypeWordLower,
"string": SpecArgumentTypeString,
+ "words": SpecArgumentTypeWords,
"tstring": SpecArgumentTypeTrimString,
"int": SpecArgumentTypeInt,
"date": SpecArgumentTypeDate,