mirror of
https://github.com/zdharma-continuum/zinit-annex-link-man.git
synced 2024-11-21 13:48:01 +01:00
7b59c8520f
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
39 lines
1.3 KiB
Bash
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 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
|