Fix splitting arguments when command has newlines
This commit is contained in:
parent
acd0872e98
commit
bb45218639
@ -281,7 +281,7 @@ class RegexArgument(Argument):
|
|||||||
def match(self, val: str, **kwargs) -> Tuple[str, Any]:
|
def match(self, val: str, **kwargs) -> Tuple[str, Any]:
|
||||||
orig_val = val
|
orig_val = val
|
||||||
if not self.pass_raw:
|
if not self.pass_raw:
|
||||||
val = val.split(" ")[0]
|
val = re.split(r"\s", val, 1)[0]
|
||||||
match = self.regex.match(val)
|
match = self.regex.match(val)
|
||||||
if match:
|
if match:
|
||||||
return (orig_val[:match.start()] + orig_val[match.end():],
|
return (orig_val[:match.start()] + orig_val[match.end():],
|
||||||
@ -299,7 +299,7 @@ class CustomArgument(Argument):
|
|||||||
if self.pass_raw:
|
if self.pass_raw:
|
||||||
return self.matcher(val)
|
return self.matcher(val)
|
||||||
orig_val = val
|
orig_val = val
|
||||||
val = val.split(" ")[0]
|
val = re.split(r"\s", val, 1)[0]
|
||||||
res = self.matcher(val)
|
res = self.matcher(val)
|
||||||
if res:
|
if res:
|
||||||
return orig_val[len(val):], res
|
return orig_val[len(val):], res
|
||||||
@ -310,7 +310,7 @@ class SimpleArgument(Argument):
|
|||||||
def match(self, val: str, **kwargs) -> Tuple[str, Any]:
|
def match(self, val: str, **kwargs) -> Tuple[str, Any]:
|
||||||
if self.pass_raw:
|
if self.pass_raw:
|
||||||
return "", val
|
return "", val
|
||||||
res = val.split(" ")[0]
|
res = re.split(r"\s", val, 1)[0]
|
||||||
return val[len(res):], res
|
return val[len(res):], res
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user