24 lines
514 B
Bash
24 lines
514 B
Bash
# print all the todos in the files in this directory
|
|
todos() {
|
|
dgrep TODO $*
|
|
}
|
|
|
|
# print all the notes in the files in this directory
|
|
notes() {
|
|
dgrep NOTE $*
|
|
}
|
|
|
|
# run a grep on all files in a directory
|
|
dgrep() {
|
|
# if no directory or file was given then use pwd
|
|
dir=${2:-$(pwd)}
|
|
# we require a pattern
|
|
if [[ -z "$1" ]]; then
|
|
echo "Must pass in a pattern" 1>&2
|
|
return 1
|
|
fi
|
|
# now we can execute
|
|
grep -n -H -I -R $1 $dir | awk -F'[ \t]*(//|#|;) ' '{print $1 "\t" $2}'
|
|
}
|
|
|