Metadata-Version: 2.3
Name: offgrep
Version: 0.3.5
Summary: A lousy ripgrep rip-off in pure Python
Keywords: grep,recursive
Author: Rainer Schwarzbach
Author-email: Rainer Schwarzbach <rainer@blackstream.de>
License: MIT License
         
         Copyright (c) 2026 Rainer Schwarzbach
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
Classifier: Development Status :: 3 - Alpha
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Environment :: Console
Classifier: Topic :: Utilities
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Requires-Python: >=3.11
Project-URL: Homepage, https://gitlab.com/blackstream-x/offgrep
Project-URL: Changelog, https://gitlab.com/blackstream-x/offgrep/-/blob/main/CHANGELOG.md
Project-URL: CI, https://gitlab.com/blackstream-x/offgrep/-/pipelines
Project-URL: Bug Tracker, https://gitlab.com/blackstream-x/offgrep/-/issues
Project-URL: Repository, https://gitlab.com/blackstream-x/offgrep.git
Project-URL: Documentation, https://blackstream-x.gitlab.io/offgrep/
Description-Content-Type: text/markdown

# offgrep

_A lousy **[ripgrep]** rip-off in pure Python_

[ripgrep]: https://github.com/burntsushi/ripgrep

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).
```
