]>
Tony Duckles's Git Repositories (git.nynim.org) - dotfiles.git/blob - bin/ack-wrapper
   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. 
   6 # Search for "local" .ackrc file in CWD or any parents 
  11 while [ "${dir}" != "/" -a "${match}" = "" ]; do 
  12     if [ -e "${dir}/.ackrc" ]; then 
  13         if [ "${dir}" != "${HOME}" ]; then 
  15             echo "(Include: ${dir}/.ackrc)" 
  16             ackrc
=$(egrep "^[^#]" "${dir}/.ackrc" | tr '\n' ' ') 
  21         dir
=$(dirname "${dir}") 
  25 # Add quote-wrapping for any additional args to ensure proper passing to 
  28     if [ -z "${ackrc}" ]; then 
  31         ackrc
="${ackrc} '${arg}'" 
  35 # Build command to eval 
  36 cmd
="command ack ${ackrc}" 
  38     # If stdin is a pipe, use cat to redirect stdin to stdout and pipe 
  43 # Eval the final command