1
0
Fork 0
mirror of https://github.com/zdharma-continuum/zinit-annex-link-man.git synced 2024-11-21 13:48:01 +01:00
zinit-annex-link-man/:za-linkman-atclone-handler
Vladislav Doster 7b59c8520f fix: use +zi-log and log message format
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2023-12-05 11:26:54 -06:00

39 lines
1.3 KiB
Bash

#!/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 ln -f -- $manfile "${ZPFX}/man/man${${${manfile:t}//[!1-9]}[-1]}" && 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}: Installed man page${${${#installed}/1/}:+s}: ${(j:, :)installed}"
fi
if (( ${#failed} )); then
+zi-log "{e} {b}linkman{rst}: Failed to install man page${${${#failed}/1/}:+s}: ${(j:, :)failed}"
fi
fi
fi