1
0
Fork 0
mirror of synced 2024-05-24 19:15:21 -04:00
zimfw/src/stage2/34_zimfw_list_unuseds.zsh.erb
Eric Nielsen 6ca4690edc
Further improve handling of external modules
Fix computing the list of unused modules by using the full `_zdirs`
instead of just the `_zmodules` names. The fixed code was even simpler
and cleaner, which makes it even more satisfying.  :- )

Show "not found" instead of "not installed" error when an external
module dir does not exist, since we don't install external modules.
2021-09-23 11:44:31 -05:00

20 lines
605 B
Plaintext

_zimfw_list_unuseds() {
local -i i=1
local -a zinstalled=(${ZIM_HOME}/modules/*(N/))
# Search into subdirectories
while (( i <= ${#zinstalled} )); do
if (( ${_zdirs[(I)${zinstalled[i]}/*]} || ${_zdisabled_dirs[(I)${zinstalled[i]}/*]} )); then
zinstalled+=(${zinstalled[i]}/*(N/))
zinstalled[i]=()
else
(( i++ ))
fi
done
# Unused = all installed dirs not in _zdirs and _zdisabled_dirs
_zunused_dirs=(${${zinstalled:|_zdirs}:|_zdisabled_dirs})
local zunused
for zunused in ${_zunused_dirs}; do
_zimfw_print -PR "%B${zunused:t}:%b ${zunused}${1}"
done
}