26 个版本
新 0.2.24 | 2024 年 8 月 21 日 |
---|---|
0.2.23 | 2024 年 8 月 21 日 |
0.2.19 | 2024 年 7 月 29 日 |
0.1.0 | 2024 年 7 月 21 日 |
63 在 并发 中
每月 1,290 次下载
27KB
586 代码行
Grip-grab 🧤
一个环境更快的、更轻量级的 ripgrep 灵感替代品。
❯ gg "\b(Read|Write)Half[^<]" tokio/src
https://github.com/user-attachments/assets/2c5ed221-77f4-4a75-9f1a-b96341f3313b
安装
使用 Cargo
cargo install grip-grab
注意: 如果使用带有 git
插件的 zsh,您可能需要取消别名 gg
,以便 grip-grab 的 gg
能够正常工作
echo 'unalias gg' >> ~/.zshrc
source ~/.zshrc
用法
❯ gg --help
A somewhat faster, more lightweight, ripgrep-inspired alternative.
Usage: gg [OPTIONS] [PATTERN] [PATHS]...
Arguments:
[PATTERN] a regex pattern to search for
[PATHS]... paths in which to search recursively
Options:
-e, --patterns <PATTERNS>
you can specify multiple patterns using -e "pattern1" -e "pattern2" etc
-I, --ignore-paths <IGNORE_PATHS>
paths to ignore when recursively walking target directory
-G, --disregard-gitignore
disregard .gitignore rules when recursively walking directory (defaults to false)
-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, --disable-colored-output
disable colored output (colored by default)
-t, --filter-filetypes <FILTER_FILETYPES>
filter on filetype (defaults to all filetypes)
-H, --disable-hyperlinks
disable hyperlinks in output (defaults to false)
-h, --help
Print help
-V, --version
Print version
示例
基本用法
❯ gg "\b(Read|Write)Half[^<]" tokio/src
JSON 输出
❯ gg --json unsplit tokio/src | jq
仅文件名
❯ gg -f "\b(Read|Write)Half[^<]" tokio/src
注释
这个轻量级工具在很大程度上基于来自非凡的 ripgrep 工具的几个 crate。它的目标是提供一个最小化和轻量级的版本,可以轻松集成到其他程序中用于搜索相关用途。
依赖关系
~9–19MB
~311K SLoC