# HG changeset patch # User Jeff Hammel # Date 1368213210 25200 # Node ID f890a12d8cf5cf2569ae9f5c1ddf41eabbd1ff80 # Parent db07fef406429dfa19f9341b3c03c4bca66c8e82 add lsdiff override for urls diff -r db07fef40642 -r f890a12d8cf5 .bash_overrides --- a/.bash_overrides Fri May 10 10:59:38 2013 -0700 +++ b/.bash_overrides Fri May 10 12:13:30 2013 -0700 @@ -1,43 +1,9 @@ #!/bin/bash - -function unlink { - command unlink `echo $@ | sed 's/\/$//g'` -} - -function find { - - if (( ! $# )) - then - return - fi - - if [ -d $1 ] - then - DIR="$1" - shift - else - DIR="$PWD" - fi - - if [ "$#" == "1" ] - then - `which find` -L "$PWD" -not -path '*.svn*' -iname "$1" - return 0 - fi - - COMMAND="`which find` -L \"$DIR\" -not -path '*.svn*' $@" -#echo $COMMAND # for debugging - `which find` -L "$DIR" -not -path '*.svn*' "$@" -} +# command overrides too elaborate for aliases cd() { - + ENV="" - # find if you're in a - if [ -n "${WORKING_ENV}" ] - then - ENV="${WORKING_ENV}" - fi if [ -n "${VIRTUAL_ENV}" ] then ENV="${VIRTUAL_ENV}" @@ -45,7 +11,7 @@ if [ -d "$@" ] - then + then command cd "$@" else if [ -e "$@" ] @@ -73,18 +39,13 @@ deactivate fi else - return + return fi fi source "bin/activate" fi ENV="" - # find if you're in a - if [ -n "${WORKING_ENV}" ] - then - ENV="${WORKING_ENV}" - fi if [ -n "${VIRTUAL_ENV}" ] then ENV="${VIRTUAL_ENV}" @@ -94,7 +55,7 @@ then FULLPWD=$(python -c 'import os; print os.getcwd()') if (( ! `expr match "${FULLPWD}" "${ENV}"` )) - then + then if [[ -n "`type -t deactivate`" ]] then deactivate @@ -104,6 +65,48 @@ unset ENV } -emacsclient() { +function emacsclient() { command emacsclient $@ > /dev/null & } + +function find { + + if (( ! $# )) + then + return + fi + + if [ -d $1 ] + then + DIR="$1" + shift + else + DIR="$PWD" + fi + + if [ "$#" == "1" ] + then + `which find` -L "$PWD" -not -path '*.svn*' -iname "$1" + return 0 + fi + + COMMAND="`which find` -L \"$DIR\" -not -path '*.svn*' $@" +#echo $COMMAND # for debugging + `which find` -L "$DIR" -not -path '*.svn*' "$@" +} + +function lsdiff { + + if expr "$1" : 'http[s]\?://.*' &> /dev/null + then + curl "$1" 2> /dev/null | command lsdiff + else + lsdiff "$1" + fi + +} + +function unlink { + command unlink `echo $@ | sed 's/\/$//g'` +} +