-
Notifications
You must be signed in to change notification settings - Fork 7
/
:za-eval-recache
44 lines (39 loc) · 1.56 KB
/
:za-eval-recache
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Copyright 2021-2023 Nicholas Serrano
# License: MIT
# Synopsis:
# zinit recache <plugin/snippet>
#
emulate -LR zsh
setopt extended_glob warn_create_global typeset_silent \
no_short_loops rc_quotes
(( ${+functions[.zinit-compute-ice]} )) || builtin source ${ZINIT[BIN_DIR]}"/zinit-side.zsh"
local -A ICE
local -a plugins snippets
local entry dir filename is_snippet REPLY reply
if [[ -z $2 ]] {
+zinit-message '{msg2}Recaching eval output of all plugins and snippets{…}{rst}'
plugins=( "${ZINIT[PLUGINS_DIR]}"/**/evalcache.zsh(N:h:t) )
plugins=( "${plugins[@]//---//}" )
plugins=( "${plugins[@]:#_local/zinit}" )
plugins=( "${plugins[@]:#custom}" )
snippets=( "${ZINIT[SNIPPETS_DIR]}"/**/evalcache.zsh(N:h) )
snippets=( ${snippets[@]#${ZINIT[SNIPPETS_DIR]}/} )
snippets=( ${snippets[@]/(#b)(http|https|ftp|ftps|scp)--/${match[1]}://} )
snippets=( ${snippets[@]/--//} )
} else {
+zinit-message "{msg2}Recaching eval output of {pid}$2{msg2}{…}{rst}"
.zinit-compute-ice $2 "pack-nf" ICE dir filename is_snippet || return $?
((is_snippet)) && snippets=($2) || plugins=($2)
}
for entry in $plugins $snippets; do
+zinit-message "{msg2}Removing {pid}$entry{msg} eval cache{…}{rst}"
[[ -e "$dir" ]] || .zinit-compute-ice $entry "pack-nf" ICE dir filename is_snippet || return $?
command rm -f "$dir"/evalcache.{zsh,zsh.zwc}
((is_snippet)) && {
:za-eval-atclone-handler snippet "" "$entry" "$dir" ""
} || {
:za-eval-atclone-handler plugin "" "" "$entry" "$dir" ""
}
unset dir
ICE=()
done