Commit f2b9731a authored by Kai Willadsen's avatar Kai Willadsen

filters: Rearrange the shell pattern split logic to be slightly clearer

parent 71ad9c44
......@@ -47,14 +47,14 @@ class FilterEntry:
@classmethod
def _compile_shell_pattern(cls, pattern):
bits = pattern.split()
if len(bits) > 1:
if not bits:
# An empty pattern would match everything, so skip it
return None
elif len(bits) > 1:
regexes = [misc.shell_to_regex(b)[:-1] for b in bits]
regex = "(%s)$" % "|".join(regexes)
elif len(bits):
regex = misc.shell_to_regex(bits[0])
else:
# An empty pattern would match everything, so skip it
return None
regex = misc.shell_to_regex(bits[0])
try:
compiled = re.compile(regex)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment