add "additional word" (aword
) command arument spec type
This commit is contained in:
parent
dc4adc4d71
commit
d438b6dbc9
1 changed files with 7 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
import enum, typing
|
import enum, typing
|
||||||
from .time import duration
|
from .time import duration
|
||||||
|
from . import try_int
|
||||||
|
|
||||||
class SpecArgumentContext(enum.IntFlag):
|
class SpecArgumentContext(enum.IntFlag):
|
||||||
CHANNEL = 1
|
CHANNEL = 1
|
||||||
|
@ -27,6 +28,11 @@ class SpecArgumentTypeWord(SpecArgumentType):
|
||||||
if args:
|
if args:
|
||||||
return args[0], 1
|
return args[0], 1
|
||||||
return None, 1
|
return None, 1
|
||||||
|
class SpecArgumentTypeAdditionalWord(SpecArgumentType):
|
||||||
|
def simple(self, args: typing.List[str]) -> typing.Tuple[typing.Any, int]:
|
||||||
|
if len(args) > 1:
|
||||||
|
return args[0], 1
|
||||||
|
return None, 1
|
||||||
class SpecArgumentTypeWordLower(SpecArgumentTypeWord):
|
class SpecArgumentTypeWordLower(SpecArgumentTypeWord):
|
||||||
def simple(self, args: typing.List[str]) -> typing.Tuple[typing.Any, int]:
|
def simple(self, args: typing.List[str]) -> typing.Tuple[typing.Any, int]:
|
||||||
out = SpecArgumentTypeWord.simple(self, args)
|
out = SpecArgumentTypeWord.simple(self, args)
|
||||||
|
@ -58,6 +64,7 @@ class SpecArgumentPrivateType(SpecArgumentType):
|
||||||
|
|
||||||
SPEC_ARGUMENT_TYPES = {
|
SPEC_ARGUMENT_TYPES = {
|
||||||
"word": SpecArgumentTypeWord,
|
"word": SpecArgumentTypeWord,
|
||||||
|
"aword": SpecArgumentTypeAdditionalWord,
|
||||||
"wordlower": SpecArgumentTypeWordLower,
|
"wordlower": SpecArgumentTypeWordLower,
|
||||||
"string": SpecArgumentTypeString,
|
"string": SpecArgumentTypeString,
|
||||||
"tstring": SpecArgumentTypeTrimString,
|
"tstring": SpecArgumentTypeTrimString,
|
||||||
|
|
Loading…
Reference in a new issue