offgrep
A lousy ripgrep rip-off in pure Python
Searches text in a grep-like manner in text files, recursively searching for files from the provided starting-point or from the current working directory.
When doing so, offgrep respects ignore rules in a .gitignore file.
This behavior is a small fraction of ripgrep’s capabilities, combined with a ridiculously low execution speed.
So if you have any chance to run the original, please use ripgrep instead of offgrep.
If you – however – are in a super restricted network (eg. government) without a chance to install ripgrep, but are able to install Python packages, offgrep might be suitable for you.
usage
usage: offgrep [-h] [-V] [--encoding ENCODING] [--verbose | --debug | -q]
[--hi {.,a,b,c,g,p,r,s,u,y,z} | --red | --green | --yellow |
--blue | --purple | --cyan | --highlighters] [--stats]
[--files] [--type-list] [--pre-ignore PATTERNS]
[--post-ignore PATTERNS] [--ignore-file-case-insensitive]
[-g PATTERN] [-t FILETYPE] [-T FILETYPE]
[--glob-case-insensitive] [-d NUM] [-e PATTERN]
[-f PATTERNFILE] [-F] [-i]
searches text in (text) files recursively
options:
-h, --help show this help message and exit
-V, --version show program's version number and exit
--encoding ENCODING Encoding of all files (default: utf-8)
Output options:
--verbose log with level INFO
--debug log with level DEBUG
-q, --quiet no output except for CRITICAL errors
--hi, --highlight-matches {.,a,b,c,g,p,r,s,u,y,z}
Highlight matches with the provided profile. The
default is 'z' (no highlighting). Use the
--highlighters option for an overview with examples.
--red Highlight matches in red.
--green Highlight matches in green.
--yellow Highlight matches in yellow.
--blue Highlight matches in blue.
--purple Highlight matches in purple.
--cyan Highlight matches in cyan.
--highlighters Show highlighter effects on examples and exit.
--stats Collect and show statistics.
--files Print the path of each file that would be searched,
without actually performing the search.
--type-list Print the list of supported file types and exit.
File selection options:
--pre-ignore PATTERNS
gitignore-style patterns for files and/or directories
ignored before applying found ignore file rules,
joined with commas (,). Defaults to VCS repository
directories ('.git/,.hg/,.jj/,.bzr/,_darcs/,.svn/').
--post-ignore PATTERNS
gitignore-style patterns for files and/or directories
ignored after applying found ignore file rules, joined
with commas (,). Empty by default ('').
--ignore-file-case-insensitive
Process ignore rules (from .gitignore, .ignore, etc,
but also those specified directly through --pre-
ignore/--post-ignore) case insensitively. Most useful
on case insensitive file systems (such as Windows).
-g, --glob PATTERN Include or exclude files and directories for searching
that match the given glob. This always overrides any
other ignore logic. Multiple glob flags may be used.
Globbing rules match .gitignore globs. Precede a glob
with a ! to exclude it.
-t, --type FILETYPE Search only in files of type FILETYPE. May be
specified multiple times. See --type-list output for
supported file types.
-T, --type-not FILETYPE
Do not search in files of type FILETYPE. May be
specified multiple times. See --type-list output for
supported file types.
--glob-case-insensitive
Process all glob patterns given with the -g/--glob
flag case insensitively.
-d, --max-depth NUM limits the depth of directory traversal to &(metavar)s
levels beyond the paths given. A value of 0 only
searches the explicitlygiven paths themselves.
Pattern matching options:
-e, --expression PATTERN
Pattern (by default, regular exoressions) to search
for. May be specified multiple times if you want to
search for multiple patterns at once.
-f, --file PATTERNFILE
File containing patterns (by default, regular
expressions). May be specified multiple times to use
multiple files.
-F, --fixed-strings treat the given pattern(s) as fixed strings instead of
regular expressions so special characters – .+*()[]{}
– do not need to be escaped, also saving some energy.
-i, --ignore-case case-insensitive matching
The provided options (or usage in a shell pipeline)
determine how the positional arguments are interpreted:
(1) offgrep [OPTIONS] PATTERN [PATH ...],
the first positional argument is interpreted as the pattern,
the remaining ones as paths.
(2) offgrep [OPTIONS] -e PATTERN ... [PATH ...]
all positional arguments are interpreted as paths.
(3) offgrep [OPTIONS] -f PATTERNFILE ... [PATH ...]
all positional arguments are interpreted as paths.
(4) offgrep [OPTIONS] --files [PATH ...]
all positional arguments are interpreted as paths.
(5) offgrep [OPTIONS] [--highlighters | --type-list]
all positional arguments are ignored.
(6) command | offgrep [OPTIONS] PATTERN
the first positional argument is interpreted as the pattern,
and the remaining positional arguments are ignored.
(7) command | offgrep [OPTIONS] -e PATTERN ...
all positional arguments are ignored.
(8) command | offgrep [OPTIONS] -f PATTERNFILE ...
all positional arguments are ignored.
If no paths were provided as positional arguments in variants 1 through 4,
the current working directory will be used as the starting point.
Variants 6 through 8 show how offgrep can be used as a filter
(ignoring all paths provided as positional arguments).
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file offgrep-0.3.4.tar.gz.
File metadata
- Download URL: offgrep-0.3.4.tar.gz
- Upload date:
- Size: 26.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Alpine Linux","version":"3.23.5","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e1780d8c262ba94b3034529049613ab8f18e129ff95a9ab1f06395bd51cffab
|
|
| MD5 |
ff5d5ec1928c230174849bd9f62f310a
|
|
| BLAKE2b-256 |
059c383f0ca912d96fc260e6f766f2144d01b0f5569d8bd4340eddff3eebb685
|
File details
Details for the file offgrep-0.3.4-py3-none-any.whl.
File metadata
- Download URL: offgrep-0.3.4-py3-none-any.whl
- Upload date:
- Size: 31.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Alpine Linux","version":"3.23.5","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1bb026903334e08fa999698d68e9d3a572e224fe545edc9c6ad1fcbdea5df13
|
|
| MD5 |
65a084f628a9e8bdb4bdf0d9c567f1c1
|
|
| BLAKE2b-256 |
7e856e01794669721f0adcf02f8db1fc12d9f628b9f1c8bde65d957a3e48928e
|