mirror of https://github.com/zulip/zulip.git
log-search: Add a filter to exclude all lines not explicitly wanted.
This commit is contained in:
parent
180565d8d6
commit
2b02722d16
|
@ -84,6 +84,9 @@ def parser() -> argparse.ArgumentParser:
|
||||||
filtering.add_argument(
|
filtering.add_argument(
|
||||||
"--report", "-r", help="Include timing report paths", action="store_true"
|
"--report", "-r", help="Include timing report paths", action="store_true"
|
||||||
)
|
)
|
||||||
|
filtering.add_argument(
|
||||||
|
"--no-other", "-O", help="Exclude paths not explicitly included", action="store_true"
|
||||||
|
)
|
||||||
|
|
||||||
output = parser.add_argument_group("Output")
|
output = parser.add_argument_group("Output")
|
||||||
output.add_argument("--full-line", "-F", help="Show full matching line", action="store_true")
|
output.add_argument("--full-line", "-F", help="Show full matching line", action="store_true")
|
||||||
|
@ -318,24 +321,24 @@ def passes_filters(
|
||||||
return True
|
return True
|
||||||
|
|
||||||
path = match["path"]
|
path = match["path"]
|
||||||
if path.startswith("/static/") and not args.static:
|
if path.startswith("/static/"):
|
||||||
return False
|
return args.static
|
||||||
if path.startswith("/user_uploads/") and not args.uploads:
|
elif path.startswith("/user_uploads/"):
|
||||||
return False
|
return args.uploads
|
||||||
if path.startswith(("/user_avatars/", "/avatar/")) and not args.avatars:
|
elif path.startswith(("/user_avatars/", "/avatar/")):
|
||||||
return False
|
return args.avatars
|
||||||
if re.match(r"/(json|api/v1)/events($|\?|/)", path) and not args.events:
|
elif re.match(r"/(json|api/v1)/events($|\?|/)", path):
|
||||||
return False
|
return args.events
|
||||||
if path in ("/api/v1/typing", "/json/typing") and not args.typing:
|
elif path in ("/api/v1/typing", "/json/typing"):
|
||||||
return False
|
return args.typing
|
||||||
if re.match(r"/(json|api/v1)/messages($|\?|/)", path) and not args.messages:
|
elif re.match(r"/(json|api/v1)/messages($|\?|/)", path):
|
||||||
return False
|
return args.messages
|
||||||
if path in ("/api/v1/users/me/presence", "/json/users/me/presence") and not args.presence:
|
elif path in ("/api/v1/users/me/presence", "/json/users/me/presence"):
|
||||||
return False
|
return args.presence
|
||||||
if path.startswith(("/api/v1/report/", "/json/report/")) and not args.report:
|
elif path.startswith(("/api/v1/report/", "/json/report/")):
|
||||||
return False
|
return args.report
|
||||||
|
else:
|
||||||
return True
|
return not args.no_other
|
||||||
|
|
||||||
|
|
||||||
def print_line(
|
def print_line(
|
||||||
|
|
Loading…
Reference in New Issue