1
0
Fork 0
mirror of synced 2024-11-16 21:15:35 -05:00
zimfw/tools/clean-modules.zsh

20 lines
616 B
Bash
Raw Normal View History

local zdir zmodule
local -a zmodules
local -A zoptions
# Source .zimrc to refresh zmodules
[[ -f ${ZDOTDIR:-${HOME}}/.zimrc ]] && source ${ZDOTDIR:-${HOME}}/.zimrc
zstyle -a ':zim' modules 'zmodules'
for zdir in ${ZIM_HOME}/modules/*(/N); do
zmodule=${zdir:t}
# If zmodules does not contain the zmodule
if (( ! ${zmodules[(I)${zmodule}]} )); then
zstyle -a ':zim:module' ${zmodule} 'zoptions'
[[ ${zoptions[frozen]} == yes ]] && continue
command rm -rf ${zdir} || return 1
[[ ${1} != -q ]] && print ${zdir}
fi
done
if [[ ${1} != -q ]]; then
print -P "%F{green}✓%f Done with ${0:t:r}."
fi