diff options
| author | 2020-01-26 11:21:23 +0000 | |
|---|---|---|
| committer | 2020-01-26 11:24:57 +0000 | |
| commit | 23d3ba5e29a92b31cfbca32721836fbb6075ecd1 (patch) | |
| tree | bc9d0b1ec4052510a5475543f4e251aa275a42e5 /src/utils/parse/spec.py | |
| parent | update karma.py to use command spec (diff) | |
| signature | ||
add tstring spec type, string with trimmed consecutive spaces
Diffstat (limited to 'src/utils/parse/spec.py')
| -rw-r--r-- | src/utils/parse/spec.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/utils/parse/spec.py b/src/utils/parse/spec.py index bb0dcc9d..46ab9ad5 100644 --- a/src/utils/parse/spec.py +++ b/src/utils/parse/spec.py @@ -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 } |
