An Interest In:
Web News this Week
- March 22, 2024
- March 21, 2024
- March 20, 2024
- March 19, 2024
- March 18, 2024
- March 17, 2024
- March 16, 2024
March 29, 2022 05:53 am GMT
Original Link: https://dev.to/adrianvalenz/custom-shell-function-in-zshrc-to-search-strings-14i5
Custom shell function in .zshrc to search strings
seek() { if [ "$1" != "" ] then grep -H -r --exclude-dir=node_modules "$1" * | less else echo "need to type in a string" fi}
I use this function when I join an existing project and I need to get familiar with the code base. I got tired of typing in grep -H -r 'string' * | less
so I created this little function to make the process quicker.
Now we just type in seek custom_method
and a list of files will appear from the project that contain that method or whatever string you passed. I added a flag to exclude node_modules
because usually that's not where you need to look and it could pull up irrelevant files.
This is helpful when searching file names is not enough. I'm pretty excited about this one. I hope it helps you out!
Original Link: https://dev.to/adrianvalenz/custom-shell-function-in-zshrc-to-search-strings-14i5
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To