-
Notifications
You must be signed in to change notification settings - Fork 5
/
:za-linkman-atclone-handler
34 lines (31 loc) · 1.29 KB
/
:za-linkman-atclone-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
emulate -RL zsh
setopt extendedglob warncreateglobal typesetsilent noshortloops
if [[ "$1" = plugin ]] {
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"
}
if (( ${+ICE[lman]} )) {
[[ -d ${ZPFX}/man/man1 ]] || \
{ +zinit-message "{pre}linkman annex: {warn}Warning: {msg}Missing {url}${ZPFX}/man/man1{msg}, not installing man pages{…}{rst}" && return}
local manfiles=${dir}/**/*(.[1-9]|.[1-9].gz)(N.)
declare -a manfile installed attempted failed
for manfile ( $~manfiles ); do
(( ${attempted[(I)$manfile:t]} )) && continue
attempted+=( $manfile:t )
{ test -f $manfile } && {
command ln -f -- $manfile "${ZPFX}/man/man${${${manfile:t}//[!1-9]}[-1]}" && \
installed+=( "{obj}$manfile:t" )
} || {
failed+=( "{obj}$manfile:t" )
}
done
if (( !OPTS[opt_-q,--quiet] )) {
if (( ${#installed} )) {
+zinit-message "{pre}linkman annex: {msg}Installed man page${${${#installed}/1/}:+s}: ${(j:, :)installed}{rst}"
}
if (( ${#failed} )) {
+zinit-message "{pre}linkman annex: {error}Could not install man page${${${#failed}/1/}:+s}: ${(j:, :)failed}{rst}"
}
}
}