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)
|
return "%s ..." % SpecArgumentType.name(self)
|
||||||
def simple(self, args: typing.List[str]) -> typing.Tuple[typing.Any, int]:
|
def simple(self, args: typing.List[str]) -> typing.Tuple[typing.Any, int]:
|
||||||
return " ".join(args), len(args)
|
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):
|
class SpecArgumentTypeDuration(SpecArgumentType):
|
||||||
def name(self):
|
def name(self):
|
||||||
|
@ -57,6 +60,7 @@ SPEC_ARGUMENT_TYPES = {
|
||||||
"word": SpecArgumentTypeWord,
|
"word": SpecArgumentTypeWord,
|
||||||
"wordlower": SpecArgumentTypeWordLower,
|
"wordlower": SpecArgumentTypeWordLower,
|
||||||
"string": SpecArgumentTypeString,
|
"string": SpecArgumentTypeString,
|
||||||
|
"tstring": SpecArgumentTypeTrimString,
|
||||||
"duration": SpecArgumentTypeDuration
|
"duration": SpecArgumentTypeDuration
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue