grep and rg skip files and lines. The
commands still walk, filter, order and label every file, so output is the same
as a full scan.
Interface
An extra file or line costs a read; a missing one is a wrong answer. A search
that holds only keys names each file with
mounted_path(under[0], "/" + key)
from mirage.utils.key_prefix (mountedPath in TypeScript).
searchable names the files files_containing answers for, as mount-relative
globs where a directory covers what is under it. A walked file outside it is
always read; None (null), the default, covers every file.
Commands and flags
These flags scan every file and call
before_full_scan with the reason:
Every other flag is applied by the walk as usual.
rg --files and
rg --type-list read no content and ask nothing. files_containing never
rules out a file named on the command line, or a binary-extension file under
grep -a, --binary-files=text, rg -a, --binary or -uuu.
Raise from before_full_scan to refuse: the command prints grep: <message>
and exits 1. A filesystem error raised at a file is that file’s read error
instead, and grep exits 2.
Backends
A word a backend’s search is known not to see reads every file: a key of the
rendered JSON, a fixed word such as a file type, a user’s name on Slack. Each
backend’s page lists what its search covers. Discord reads every file, since a
reply carries the message it answers, which its search does not tie to the
reply.