mirror of
https://github.com/eth-p/bat-extras.git
synced 2024-11-08 16:54:08 +01:00
76 lines
4.0 KiB
Markdown
76 lines
4.0 KiB
Markdown
# bat-extras: batgrep
|
|
|
|
A script that combines [ripgrep](https://github.com/burntsushi/ripgrep) with bat's syntax highlighting and output formatting.
|
|
|
|
|
|
|
|
## Command Line
|
|
|
|
**Synopsis:**
|
|
|
|
- `batgrep [OPTIONS] PATTERN [PATH...] `
|
|
|
|
|
|
|
|
**Options:**
|
|
|
|
| Short | Long | Description |
|
|
| ----- | -------------------------- | ------------------------------------------------------------ |
|
|
| `-i` | `--ignore-case` | Use case insensitive searching. |
|
|
| `-A` | `--after-context=[LINES]` | Display the next *n* lines after a matched line. |
|
|
| `-B` | `--before-context=[LINES]` | Display the previous `n` lines before a matched line. |
|
|
| `-C` | `--context=[LINES]` | A combination of `--after-context` and `--before-context`. |
|
|
| | `--no-follow` | Do not follow symlinks. |
|
|
| | `--no-snip` | Do not show the `snip` decoration.<br /><br />This is automatically enabled when `--context=0` or when `bat --version` is less than `0.12.x`. |
|
|
| | `--no-highlight` | Do not highlight matching lines.<br /><br />This is automatically enabled when `--context=0`. |
|
|
| | `--color` | Force color output. |
|
|
| | `--no-color` | Force disable color output. |
|
|
|
|
|
|
|
|
**Options (Passthrough)**:
|
|
The following options are passed directly to ripgrep, and are not handled by this script.
|
|
|
|
| Short | Long | Notes |
|
|
| ----- | -------------------------- | ------------------------------------------------------------ |
|
|
| `-F` | `--fixed-strings` | |
|
|
| `-U` | `--multiline` | |
|
|
| `-P` | `--pcre2` | |
|
|
| `-z` | `--search-zip` | |
|
|
| `-w` | `--word-regexp` | |
|
|
| | `--one-file-system` | |
|
|
| | `--multiline-dotall` | |
|
|
| | `--ignore` / `--no-ignore` | |
|
|
| | `--crlf` / `--no-crlf` | |
|
|
| | `--hidden` / `--no-hidden` | |
|
|
| `-E` | `--encoding` | This is unsupported by `bat`, and may cause issues when trying to display unsupported encodings. |
|
|
| `-g` | `--glob` | |
|
|
| `-t` | `--type` | |
|
|
| `-T` | `--type-not` | |
|
|
| `-m` | `--max-count` | |
|
|
| | `--max-depth` | |
|
|
| | `--iglob` | |
|
|
| | `--ignore-file` | |
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
This script is a part of the `bat-extras` suite of scripts. You can find install instructions [here](../README.md#installation).
|
|
|
|
|
|
|
|
## Caveats
|
|
|
|
**Differences from ripgrep:**
|
|
|
|
- `--follow` is enabled by default for `batgrep`.
|
|
|
|
- Not all the `ripgrep` options are supported.
|
|
|
|
|
|
|
|
## Issues?
|
|
|
|
If you find an issue or have a feature suggestion, make a pull request or issue through GitHub!
|
|
Contributions are always welcome. |