Mercurial > hg > config
comparison .bash_overrides @ 305:fac01a1bcedf
add an apply-patch function
| author | Jeff Hammel <jhammel@mozilla.com> | 
|---|---|
| date | Tue, 14 May 2013 18:29:24 -0700 | 
| parents | 1a177f9b51d4 | 
| children | 597455a28c49 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 304:7ed290454f50 | 305:fac01a1bcedf | 
|---|---|
| 1 #!/bin/bash | 1 #!/bin/bash | 
| 2 # command overrides too elaborate for aliases | 2 | 
| 3 ### command overrides too elaborate for aliases | |
| 3 | 4 | 
| 4 cd() { | 5 cd() { | 
| 5 | 6 | 
| 6 ENV="" | 7 ENV="" | 
| 7 if [ -n "${VIRTUAL_ENV}" ] | 8 if [ -n "${VIRTUAL_ENV}" ] | 
| 71 | 72 | 
| 72 function find { | 73 function find { | 
| 73 | 74 | 
| 74 if (( ! $# )) | 75 if (( ! $# )) | 
| 75 then | 76 then | 
| 76 return | 77 command find | 
| 78 return | |
| 77 fi | 79 fi | 
| 78 | 80 | 
| 79 if [ -d $1 ] | 81 if [ -d $1 ] | 
| 80 then | 82 then | 
| 81 DIR="$1" | 83 DIR="$1" | 
| 94 #echo $COMMAND # for debugging | 96 #echo $COMMAND # for debugging | 
| 95 `which find` -L "$DIR" -not -path '*.svn*' "$@" | 97 `which find` -L "$DIR" -not -path '*.svn*' "$@" | 
| 96 } | 98 } | 
| 97 | 99 | 
| 98 function lsdiff { | 100 function lsdiff { | 
| 99 | 101 # TODO: extract this general pattern as a bash "decorator" | 
| 100 if expr "$1" : 'http[s]\?://.*' &> /dev/null | 102 if expr "$1" : 'http[s]\?://.*' &> /dev/null | 
| 101 then | 103 then | 
| 102 curl --location "$1" 2> /dev/null | command lsdiff | 104 curl --location "$1" 2> /dev/null | command lsdiff | 
| 103 else | 105 else | 
| 104 lsdiff "$1" | 106 lsdiff "$1" | 
