[grep] raise an IMException if pattern not found
This commit is contained in:
parent
1d18305870
commit
9ff8a3a02b
@ -76,8 +76,13 @@ def cmd_grep(msg):
|
|||||||
|
|
||||||
only = "only" in msg.kwargs
|
only = "only" in msg.kwargs
|
||||||
|
|
||||||
return [m for m in grep(msg.args[0] if msg.args[0][0] == "^" else ".*?(" + msg.args[0] + ").*?",
|
l = [m for m in grep(msg.args[0] if msg.args[0][0] == "^" else ".*?(" + msg.args[0] + ").*?",
|
||||||
msg.args[1][1:] if msg.args[1][0] == "!" else msg.args[1],
|
msg.args[1][1:] if msg.args[1][0] == "!" else msg.args[1],
|
||||||
msg.args[2:],
|
msg.args[2:],
|
||||||
msg,
|
msg,
|
||||||
only=only)]
|
only=only) if m is not None]
|
||||||
|
|
||||||
|
if len(l) <= 0:
|
||||||
|
raise IMException("Pattern not found in output")
|
||||||
|
|
||||||
|
return l
|
||||||
|
Loading…
Reference in New Issue
Block a user