Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Script info
rg) on PATHDescription
/weelog [options] TEXTsearches the files underlogger.file.pathwithripgrep and prints the hits into a
weelogbuffer, oldest first, with thelogged timestamp in the time column and the nick in WeeChat's own colour.
Options narrow the search by nick (
-nick, fuzzy, nick column only),network and buffer (
-net,-chan, or-herefor the current buffer),date (
-from,-to), and widen it to status lines (-events), rotated.gz/.zstarchives (-archives) and server/services/bouncer buffers(
-system).-context Nshows dimmed lines around each hit. Matchingignores case unless
-case. Both logger layouts are understood (the flatplugin.name.weechatlogfiles and the datedYYYY/network/tree). Theresults buffer is
no_log, and typing in it repeats the search.rg runs through
hook_process_hashtablewitharg1..argN, so nothinggoes through a shell; WeeChat is not blocked while it runs. Developed and
tested with WeeChat 5.0.0-dev and Python 3.14; the script uses
hook_process_hashtable,string_eval_path_homeand thenick_colorinfo, nothing newer.
How this relates to grep.py: grep.py is a general regular-expression tool
over open buffers and log files with no dependencies, and it has features
this script does not (searching a buffer's lines, invert, count, only-match,
head/tail, pattern templates). weelog is a filter-driven search over the log
directory that needs ripgrep installed. On a 2.6 GiB tree of 84,580 log
files, grep.py's file loop and ripgrep found the same 1563 hits for the
same pattern in 27.8 s and 0.69 s respectively. That speed, together with
the nick/network/buffer/date filters and archive decompression, is the
reason for a separate script.
The script is a generated single file; the source, tests and a headless
WeeChat test harness live in the upstream repository.
Testing:
/script load /path/to/weelog.py, then/weelog some words,/weelog -nick NICK -from 2026-01-01 some words,/weelog -context 2 -here text.Checklist (new script)
New script name.py: short description…hook_url,hook_processorhook_process_hashtableis used for any blocking call