Điểm qua tomnomnom/gf: 2.1k sao trên GitHub, viết chủ yếu bằng Go. A wrapper around grep, to help you grep for things
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
A wrapper around grep to avoid typing common patterns.
What? Why?
I use grep a lot. When auditing code bases, looking at the output of meg,
or just generally dealing with large amounts of data. I often end up using fairly complex patterns like this one:
It's really easy to mess up when typing all of that, and it can be hard to know if you haven't got any
results because there are non to find, or because you screwed up writing the pattern or chose the wrong flags.
I wrote gf to give names to the pattern and flag combinations I use all the time. So the above command
becomes simply:
▶ gf php-sources
Pattern Files
The pattern definitions are stored in ~/.gf as little JSON files that can be kept under version control:
To get auto-complete working you need to source the gf-completion.bash file in your .bashrc or similar:
source ~/path/to/gf-completion.bash
Zsh
To get auto-complete working you need to enable autocomplete (not needed if you have oh-my-zsh) using autoload -U compaudit && compinit or by putting it into .zshrc
Then source the gf-completion.zsh file in your .zshrc or similar:
source ~/path/to/gf-completion.zsh
Note: if you're using oh-my-zsh or similar you may find that gf is an alias for git fetch. You can either
alias the gf binary to something else, or unalias gf to remove the git fetch alias.
Using custom engines
There are some amazing code searching engines out there that can be a better replacement for grep.
A good example is the silver searcher.
It's faster (like way faster) and presents the results in a more visually digestible manner.
In order to utilize a different engine, add engine: <other tool> to the relevant pattern file:
# Using the silver searcher instead of grep for the aws-keys pattern:
# 1. Adding "ag" engine
# 2. Removing the E flag which is irrelevant for ag
{
"engine": "ag",
"flags": "-Hanr",
"pattern": "([^A-Z0-9]|^)(AKIA|A3T|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{12,}"
}
Note: Different engines use different flags, so in the example above, the flag E has to be removed from the aws-keys.json file in order for ag to successfully run.
Install
If you've got Go installed and configured you can install gf with:
▶ go get -u github.com/tomnomnom/gf
If you've installed using go get, you can enable auto-completion to your .bashrc like this:
My personal patterns that I've included as examples might not be very useful to you, but hopefully
they're still a reasonable point of reference.
Contributing
I'd actually be most interested in new pattern files! If you've got something you regularly grep for
then feel free to issue a PR to add new pattern files to the examples directory.
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/tomnomnom/gf là nguồn chính thức.
tomnomnom/gf có phải mã nguồn mở không?
Có — tomnomnom/gf phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/tomnomnom/gf.
tomnomnom/gf có website riêng không?
TopGit chưa ghi nhận URL trang chủ cho tomnomnom/gf. Phần README ở tab phía trên thường có link demo, hoặc xem mô tả GitHub của repo.
tomnomnom/gf dùng license gì?
tomnomnom/gf phát hành theo license MIT. Nên mở file LICENSE trên GitHub để xác nhận — license metadata đôi khi lệch với thực tế dự án.
tomnomnom/gf là gì?
tomnomnom/gf (tomnomnom/gf) là dự án Go trên GitHub. Theo mô tả gốc: A wrapper around grep, to help you grep for things
Đọc đầy đủ README ở tab phía trên.
Chưa chắc gf có hợp với bạn?
Để ChatGPT, Claude hoặc Perplexity tìm hiểu giúp — bấm bên dưới và xem AI nói gì về gf.