As an open-source project, tomnomnom/gf has picked up 2.1k stars on GitHub (Go). A wrapper around grep, to help you grep for things
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
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.
No homepage URL was recorded for tomnomnom/gf in TopGit's last sync. The README tab above frequently contains screenshots and demo links, or check the repository description on GitHub.
Is tomnomnom/gf open source?
Yes — tomnomnom/gf ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/tomnomnom/gf.
What is tomnomnom/gf?
tomnomnom/gf (tomnomnom/gf) is a Go project on GitHub. From the project's own README: A wrapper around grep, to help you grep for things
What license does tomnomnom/gf use?
tomnomnom/gf is released under the MIT license. Always verify the LICENSE file directly on GitHub for the authoritative terms — license strings can be edited out of sync with a project's actual stance.
Where do I read more about tomnomnom/gf?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/tomnomnom/gf is the definitive source.
Read full README in the tab above.
Is gf worth your time?
ChatGPT, Claude and Perplexity can all read this page. Ask one of them what it makes of gf.