forked from NICHOLAS85/z-a-linkman
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path:za-linkman-atdelete-handler
39 lines (35 loc) · 1.29 KB
/
:za-linkman-atdelete-handler
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
#!/usr/bin/env zsh
emulate -LR zsh
setopt extendedglob noshortloops typesetsilent warncreateglobal
if [[ "$1" = plugin ]]; then
local type="$1" user="$2" plugin="$3" id_as="$4" dir="${5#%}" hook="$6"
else
local type="$1" url="$2" id_as="$3" dir="${4#%}" hook="$5"
fi
if (( ${+ICE[lman]} )); then
if [[ ! -d ${ZPFX}/man/man1 ]]; then
+zi-log "{w} {b}linkman{rst}: Missing {url}${ZPFX}/man/man1{rst}, not installing man pages"
return
fi
local manfiles=${dir}/**/*(.[1-9]|.[1-9].gz)(N.)
declare -a manfile installed attempted failed
for manfile in $~manfiles; do
(( ${attempted[(I)$manfile:t]} )) && continue
attempted+=($manfile:t)
{
test -f $manfile
} && {
command rm -f -- "${ZPFX}/man/man${${${manfile:t}//[!1-9]}[-1]}/$manfile:t" && installed+=("{obj}${manfile:t}{rst}")
} || {
failed+=("{obj}${manfile:t}{rst}")
}
done
if (( !OPTS[opt_-q,--quiet] )); then
if (( ${#installed} )); then
+zi-log "{m} {b}linkman{rst}: Removed man page${${${#installed}/1/}:+s}: ${(j:, :)installed}"
fi
if (( ${#failed} )); then
+zi-log "{e} {b}linkman{rst}: Failed to remove man page${${${#failed}/1/}:+s}: ${(j:, :)failed}"
fi
fi
fi