--- contrib/cdargs-bash.sh.orig 2010-01-11 21:28:40.000000000 +0100 +++ contrib/cdargs-bash.sh 2010-01-11 21:31:05.000000000 +0100 @@ -11,6 +11,13 @@ CDARGS_SORT=0 # set to 1 if you want mark to sort the list CDARGS_NODUPS=1 # set to 1 if you want mark to delete dups +# Support ZSH via its BASH completion emulation +if [ -n "$ZSH_VERSION" ]; then + autoload bashcompinit + bashcompinit +fi + + # --------------------------------------------- # # Run the cdargs program to get the target # # directory to be used in the various context # @@ -142,8 +149,8 @@ # @access public # # @return void # # --------------------------------------------- # -function cdb () -{ +function cdb () +{ local dir _cdargs_get_dir "$1" && cd "$dir" && echo `pwd`; @@ -161,25 +168,25 @@ # @access public # # @return void # # --------------------------------------------- # -function mark () -{ +function mark () +{ local tmpfile # first clear any bookmarks with this same alias, if file exists - if [[ "$CDARGS_NODUPS" && -e "$HOME/.cdargs" ]]; then + if [ "$CDARGS_NODUPS" ] && [ -e "$HOME/.cdargs" ]; then tmpfile=`echo ${TEMP:-${TMPDIR:-/tmp}} | sed -e "s/\\/$//"` tmpfile=$tmpfile/cdargs.$USER.$$.$RANDOM grep -v "^$1 " "$HOME/.cdargs" > $tmpfile && 'mv' -f $tmpfile "$HOME/.cdargs"; fi # add the alias to the list of bookmarks - cdargs --add=":$1:`pwd`"; + cdargs --add=":$1:`pwd`"; # sort the resulting list if [ "$CDARGS_SORT" ]; then sort -o "$HOME/.cdargs" "$HOME/.cdargs"; fi } -# Oh, no! Not overwrite 'm' for stefan! This was -# the very first alias I ever wrote in my un*x +# Oh, no! Not overwrite 'm' for stefan! This was +# the very first alias I ever wrote in my un*x # carreer and will always be aliased to less... # alias m='mark' @@ -198,7 +205,7 @@ function ca () { # add the alias to the list of bookmarks - cdargs --add=":$1:`pwd`"; + cdargs --add=":$1:`pwd`"; } # --------------------------------------------- #