From: Bernhard Tittelbach Date: Fri, 13 Apr 2012 20:05:16 +0000 (+0200) Subject: zsh: purge: make purge take an optional dir argument so it can be used e.g. with... X-Git-Tag: v0.6.0~1 X-Git-Url: http://git.grml.org/?p=grml-etc-core.git;a=commitdiff_plain;h=a4cd061ce9e2659aaad733e5a601574233c112d7 zsh: purge: make purge take an optional dir argument so it can be used e.g. with zargs --max-args 1 -- **/ -- purge --- diff --git a/usr_share_grml/zsh/functions/purge b/usr_share_grml/zsh/functions/purge index c4e3e8b..3acf28d 100644 --- a/usr_share_grml/zsh/functions/purge +++ b/usr_share_grml/zsh/functions/purge @@ -4,6 +4,8 @@ emulate -L zsh setopt HIST_SUBST_PATTERN local -a TEXTEMPFILES GHCTEMPFILES PYTEMPFILES FILES +[[ -d "$1" ]] && { TRAPEXIT() { popd -q } && pushd -q "$1" } + TEXTEMPFILES=(*.tex(N:s/%tex/'(log|toc|aux|nav|snm|out|tex.backup|bbl|blg|bib.backup|vrb|lof|lot|hd|idx)(N)'/)) GHCTEMPFILES=(*.(hs|lhs)(N:r:s/%/'.(hi|hc|(p|u|s)_(o|hi))(N)'/)) @@ -39,7 +41,8 @@ local CURDIRSUDO="" [[ ! -w ./ ]] && CURDIRSUDO=$SUDO if [[ $NBFILES > 0 ]] ; then - print -l $FILES + print "in $PWD:" + print -f " %s\n" $FILES local ans echo -n "Remove these files? [y/N] " read -q ans; echo