X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=usr_share_grml%2Fzsh%2Ffunctions%2Fpurge;h=344e82119c55a01e4f59b707048f145c64bb7ed1;hb=HEAD;hp=aa5066a6279e9a2880da615b4ad67777a3e7e5f5;hpb=dffa45464d731201c72023092498d532d1799920;p=grml-etc-core.git diff --git a/usr_share_grml/zsh/functions/purge b/usr_share_grml/zsh/functions/purge index aa5066a..fab7fcd 100644 --- a/usr_share_grml/zsh/functions/purge +++ b/usr_share_grml/zsh/functions/purge @@ -2,15 +2,18 @@ emulate -L zsh setopt HIST_SUBST_PATTERN -local -a TEXTEMPFILES GHCTEMPFILES PYTEMPFILES FILES +local -a TEXTEMPFILES GHCTEMPFILES PYTEMPFILES +local -a -U FILES -TEXTEMPFILES=(*.tex(N:s/%tex/'(log|toc|aux|nav|snm|out|tex.backup|bbl|blg|bib.backup|vrb|lof|lot|hd|idx)(N)'/)) +[[ -d "$1" ]] && { TRAPEXIT() { popd -q } && pushd -q "$1" } -GHCTEMPFILES=(*.(hs|lhs)(N:r:s/%/'.(hi|hc|(p|u|s)_(o|hi))(N)'/)) +TEXTEMPFILES=(*.tex(N-.:s/%tex/'(log|toc|aux|nav|snm|out|tex.backup|bbl|blg|bib.backup|vrb|lof|lot|hd|idx|fdb_latexmk|fls|glo|ilg|ind|synctex.gz)(.N)'/)) -PYTEMPFILES=(*.py(N:s/%py/'(pyc|pyo)(N)'/)) +GHCTEMPFILES=(*.(hs|lhs)(N-.:r:s/%/'.(hi|hc|(p|u|s)_(o|hi))(.N)'/)) -LONELY_MOOD_FILES=((*.mood)(.NDe:'local -a AF;AF=( ${${REPLY#.}%mood}(mp3|flac|ogg|asf|wmv|aac)(N) ); [[ -z "$AF" ]]':)) +PYTEMPFILES=(*.py(N-.:s/%py/'(pyc|pyo)(.N)'/)) + +LONELY_MOOD_FILES=((*.mood)(.NDe:'local -a AF;AF=( ${${REPLY#.}%mood}(mp3|flac|ogg|asf|wmv|aac)(N-.) ); [[ -z "$AF" ]]':)) ZSH_COMPILED=(*.zwc(.NDe:'[[ -f ${REPLY%.zwc} && ${REPLY%.zwc} -nt ${REPLY} ]]':)) @@ -18,8 +21,10 @@ FILES=( *~(.N) \#*\#(.N) *.o(.N) + *.d(.N) + *.d.<->(.N) a.out(.N) - (*.|)core(.N) + (*.|)core(|.<->)(.N) *.cmo(.N) *.cmi(.N) .*.swp(.N) @@ -39,11 +44,12 @@ 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] " + echo -n "Remove these files? [y/N] " read -q ans; echo - if [[ $ans == "y" ]] ; then + if [[ $ans == [yY] ]] ; then $CURDIRSUDO rm ${FILES} echo ">> $PWD purged, $NBFILES files removed" else