add command spec type "words" - array of remaining words
This commit is contained in:
parent
c4136a50ec
commit
460cda87bb
1 changed files with 7 additions and 0 deletions
|
@ -51,6 +51,12 @@ class SpecArgumentTypeString(SpecArgumentType):
|
||||||
class SpecArgumentTypeTrimString(SpecArgumentTypeString):
|
class SpecArgumentTypeTrimString(SpecArgumentTypeString):
|
||||||
def simple(self, args: typing.List[str]):
|
def simple(self, args: typing.List[str]):
|
||||||
return SpecArgumentTypeString.simple(self, list(filter(None, args)))
|
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):
|
class SpecArgumentTypeInt(SpecArgumentType):
|
||||||
def simple(self, args):
|
def simple(self, args):
|
||||||
|
@ -84,6 +90,7 @@ SPEC_ARGUMENT_TYPES = {
|
||||||
"aword": SpecArgumentTypeAdditionalWord,
|
"aword": SpecArgumentTypeAdditionalWord,
|
||||||
"wordlower": SpecArgumentTypeWordLower,
|
"wordlower": SpecArgumentTypeWordLower,
|
||||||
"string": SpecArgumentTypeString,
|
"string": SpecArgumentTypeString,
|
||||||
|
"words": SpecArgumentTypeWords,
|
||||||
"tstring": SpecArgumentTypeTrimString,
|
"tstring": SpecArgumentTypeTrimString,
|
||||||
"int": SpecArgumentTypeInt,
|
"int": SpecArgumentTypeInt,
|
||||||
"date": SpecArgumentTypeDate,
|
"date": SpecArgumentTypeDate,
|
||||||
|
|
Loading…
Reference in a new issue