]> Tony Duckles's Git Repositories (git.nynim.org) - dotfiles.git/blob - bin/ack-wrapper
.vimrc: <F7> to toggle spell-check
[dotfiles.git] / bin / ack-wrapper
1 #!/bin/sh
2 # Wrapper around 'ack' to crawl all directories from $PWD to / (or $HOME)
3 # looking for a "local" .ackrc file. Useful for setting project-level
4 # --ignore-dir settings.
5
6 PWD=$(pwd)
7 HOME=~
8 ACKARGS=""
9
10 match=""
11 dir="$PWD"
12 while [ "$dir" != "/" -a "$match" = "" ]; do
13 if [ -e "$dir/.ackrc" ]; then
14 if [ "$dir" != "$HOME" ]; then
15 match=1
16 echo "(Include: ${dir}/.ackrc)"
17 ACKARGS="$(egrep "^[^#]" "${dir}/.ackrc" | xargs) $ACKARGS"
18 else
19 match=0
20 fi
21 else
22 dir=$(dirname "$dir")
23 fi
24 done
25
26 command ack $ACKARGS $*