[tools] Clean zcompdump_file and .zwc.old files

Consider the `zcompdump_file` variable, that could be defined in
`.zimrc`, when cleaning the cache.

A custom zcompdump_file would not be cleaned from the cache without this
correction.

Also remove *.zwc.old files from cache, as zrecompile also generates
these.

Closes #218
This commit is contained in:
Eric Nielsen 2017-09-26 17:16:26 -05:00
parent 55df5a4755
commit ab3b20f8cd
2 changed files with 4 additions and 3 deletions

View File

@ -25,7 +25,7 @@ case ${1} in
;; ;;
issue) zsh ${tools}/zim_issue issue) zsh ${tools}/zim_issue
;; ;;
clean-cache) zsh ${tools}/zim_clean_cache && print 'Cleaned cache' clean-cache) source ${tools}/zim_clean_cache && print 'Cleaned cache'
;; ;;
build-cache) source ${tools}/zim_build_cache && print 'Rebuilt cache' build-cache) source ${tools}/zim_build_cache && print 'Rebuilt cache'
;; ;;

View File

@ -2,7 +2,8 @@
# zim_clean_cache - removes all zcompiled files # zim_clean_cache - removes all zcompiled files
# #
find ${ZIM_HOME} -iname '*.zwc' | xargs rm find ${ZIM_HOME} \( -name '*.zwc' -or -name '*.zwc.old' \) -delete
rm -f ${ZDOTDIR:-${HOME}}/.{zshrc.zwc,zcompdump,zcompdump.zwc} rm -f ${ZDOTDIR:-${HOME}}/.zshrc.zwc{,.old}
rm -f ${ZDOTDIR:-${HOME}}/${zcompdump_file:-.zcompdump}{,.zwc{,.old}}
print 'To rebuild the completion cache, please restart your terminal' print 'To rebuild the completion cache, please restart your terminal'