Go to file
Alexandre Pasmantier d5558f029a bump version
2024-07-21 16:33:25 +02:00
src feat(printer): add support for colored output 2024-07-21 16:32:33 +02:00
.gitignore first commit 2024-07-21 01:56:54 +02:00
Cargo.lock bump version 2024-07-21 16:33:25 +02:00
Cargo.toml bump version 2024-07-21 16:33:25 +02:00
README.md Update README.md 2024-07-21 16:31:03 +02:00

Grip-grab 🧤

A faster, more lightweight, ripgrep alternative.

 gg "regex_pattern" .

Installation

Using Cargo

 cargo install grip-grab

NOTE: if using zsh with the git plugin, you might need to add the following line to your ~/.zshrc in order for gg to work:

unalias gg

Usage

 gg --help
A faster, more lightweight, ripgrep alternative.

Usage: gg [OPTIONS] <PATTERN> <PATH>

Arguments:
  <PATTERN>  a regex pattern to search for
  <PATH>     path in which to search recursively

Options:
  -I, --ignore-paths <IGNORE_PATHS>  paths to ignore when recursively walking target directory
  -G, --respect-gitignore            respect .gitignore when recursively walking directory
  -M, --max-results <MAX_RESULTS>    upper boundary for the number of results to expect (will panic if #results > max_results) [default: 1000]
  -T, --n-threads <N_THREADS>        number of threads to use [default: 4]
  -U, --multiline                    enable multiline matching
      --json                         output in JSON format
  -f, --file-paths-only              output file paths only
  -A, --absolute-paths               output absolute paths (defaults to relative)
  -C, --colored-output               toggle colored output (defaults to ON)
  -h, --help                         Print help
  -V, --version                      Print version

Examples

Basic usage

 gg "for" .
Screenshot 2024-07-21 at 16 21 25

JSON output

 gg "impl" . --json | jq
{
  "path": "/somewhere/gg/src/search.rs",
  "results": [
    {
      "line_number": 23,
      "line": "impl fmt::Display for FileResults {\n"
    },
    {
      "line_number": 33,
      "line": "impl FileResults {\n"
    },
    {
      "line_number": 43,
      "line": "impl<'a> IntoIterator for &'a FileResults {\n"
    }
  ]
}
{
  "path": "/somewhere/gg/src/printer.rs",
  "results": [
    {
      "line_number": 17,
      "line": "impl Printer {\n"
    }
  ]
}

Filenames only

 gg "for" . -f
Screenshot 2024-07-21 at 16 29 27