Last active
October 16, 2020 14:13
-
-
Save rosswintle/4d74e63d9b25d1c0b0824d15dd377822 to your computer and use it in GitHub Desktop.
Command-line (bash) code-searching functions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add these to your .bashrc file for some quick and clever recursive web-dev code searching | |
# from the command line/terminal. | |
# | |
# Should be easy enough to add your own too. | |
# | |
# Usage is just: | |
# | |
# phprgrep <regular expression> | |
# | |
# Regular expresssions need to be escaped/quoted if you're being clever. | |
# This is not a tutorial on escaping stuff on the command line. Google it! | |
# Recursive search of PHP files | |
phprgrep() { | |
grep -r --include="*.php" --exclude="vendor/*" $1 * | |
} | |
# Recursive search of CSS files | |
cssgrep() { | |
grep -r --include="*.css" --include="*.scss" $1 * | |
} | |
# Recursive search of SCSS files | |
scssgrep() { | |
grep -r --include="*.scss" $1 * | |
} | |
alias sassgrep="scssgrep" | |
# Recursive search of JS files | |
jsgrep() { | |
grep -r --include="*.js" --exclude="node_modules/*" $1 * | |
} | |
# Recursive search of Statamic files | |
sgrep() { | |
grep -r --include="*.php" --include="*.yaml" --include="*.md" $1 * | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment