add tstring spec type, string with trimmed consecutive spaces
This commit is contained in:
parent
6169399b7e
commit
23d3ba5e29
1 changed files with 4 additions and 0 deletions
|
@ -39,6 +39,9 @@ class SpecArgumentTypeString(SpecArgumentType):
|
|||
return "%s ..." % SpecArgumentType.name(self)
|
||||
def simple(self, args: typing.List[str]) -> typing.Tuple[typing.Any, int]:
|
||||
return " ".join(args), len(args)
|
||||
class SpecArgumentTypeTrimString(SpecArgumentTypeString):
|
||||
def simple(self, args: typing.List[str]):
|
||||
return SpecArgumentTypeString.simple(self, list(filter(None, args)))
|
||||
|
||||
class SpecArgumentTypeDuration(SpecArgumentType):
|
||||
def name(self):
|
||||
|
@ -57,6 +60,7 @@ SPEC_ARGUMENT_TYPES = {
|
|||
"word": SpecArgumentTypeWord,
|
||||
"wordlower": SpecArgumentTypeWordLower,
|
||||
"string": SpecArgumentTypeString,
|
||||
"tstring": SpecArgumentTypeTrimString,
|
||||
"duration": SpecArgumentTypeDuration
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue