Skip to content

Commit

Permalink
fix: formatting
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Doster <[email protected]>
  • Loading branch information
vladdoster committed Nov 29, 2023
1 parent 3637920 commit da2c26f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 23 deletions.
33 changes: 20 additions & 13 deletions :za-lb-atclone-handler
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
#!/usr/bin/env zsh
#
#!/usr/bin/env zsh
# Original work Copyright (c) 2019-2020 Sebastian Gniazdowski
# Modified work Copyright (c) 2020-2021 Nicholas Serrano
# Modified work Copyright (c) 2022 zdharma-continuum and contributors
#

emulate -RL zsh
setopt extendedglob warncreateglobal typesetsilent noshortloops nullglob


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[sbin]} )); then
(( !OPTS[opt_-q,--quiet] )) && +zinit-message "{w} linkbin annex: {ice}sbin{msg} ice detected, not doing anything"
return
fi
# if (( ${+ICE[sbin]} )); then

# if (( ${+ICE[sbin]} || ${+ZINIT_ICE[sbin]} )); then
+zi-log -- "{dbg} {b}linkbin annex{rst}: {ice}sbin{rst} ice detected, not doing anything"
# return
# fi

if (( ${+ICE[lbin]} )); then
if (( ${+ICE[sbin]} || ${+ZINIT_ICE[sbin]} )); then
+zi-log -- "{dbg} {b}linkbin annex{rst}: {ice}sbin{rst} ice detected, not doing anything"
return
fi
emulate -RL zsh
setopt extendedglob warncreateglobal typesetsilent noshortloops
(
local lbin sym="-P"
local -a lbins srcdst
Expand All @@ -42,7 +49,7 @@ if (( ${+ICE[lbin]} )); then
(7) [[ -n $plugin ]] && files=($dir/**/$plugin(Nnon.)) ;;
(8) [[ -n $url ]] && files=($dir/**/${url:t}(Nnon.)) ;;
(9) files=($dir/**/*(*Nnon.:t)) ;;
(10) +zinit-message "{e} linkbin annex: The automatic-empty {ice}lbin{rst} ice didn't find any executable files" ;;
(10) +zi-log "{e} {b}linkbin annex{rst}: {ice}lbin{rst} ice did not detect any executable files" ;;
esac
done
[[ $i -gt 9 ]] && break
Expand All @@ -62,7 +69,7 @@ if (( ${+ICE[lbin]} )); then
eval "fnames=(${srcdst[1]}(Nnon-.))"
fi
if (( !${#fnames} )); then
+zinit-message "{e} linkbin annex: {ice}lbin{rst} ice ({glob}$lbin{rst}) did not match any files"
+zi-log "{e} {b}linkbin annex{rst}: {ice}lbin{rst} ice ({glob}$lbin{rst}) did not match any files"
continue
fi
for fname in $fnames; do
Expand All @@ -75,17 +82,17 @@ if (( ${+ICE[lbin]} )); then
if [[ -x $file ]]; then
if [[ -x $target_binary ]]; then
if (( !OPTS[opt_-q,--quiet] )) && [[ $hook == atclone-<-> || $ZINIT[annex-multi-flag:pull-active] -ge 1 ]]; then
+zinit-message "{m} linkbin annex: ${${${hook:#*atclone-<->}:+Re-c}:-C}reated {obj}$fnam{rst} ${${${sym#-P}:+soft}:-hard} link & set +x on the {obj}${target_binary:t}{rst} binary"
+zi-log "{m} {b}linkbin annex{rst}: ${${${hook:#*atclone-<->}:+Re-c}:-C}reated {file}$fnam{rst} ${${${sym#-P}:+soft}:-hard} link & set +x on the {file}${target_binary:t}{rst} binary"
fi
else
+zinit-message "{m} linkbin annex: ${${${hook:#*atclone-<->}:+Re-c}:-C}reated {obj}$fnam{rst} ${${${sym#-P}:+soft}:-hard} link, but {obj}${target_binary:t}{rst} binary does not exist or failed to set +x on it"
+zi-log "{m} {b}linkbin annex{rst}: ${${${hook:#*atclone-<->}:+Re-c}:-C}reated {file}$fnam{rst} ${${${sym#-P}:+soft}:-hard} link, but {file}${target_binary:t}{rst} binary does not exist or failed to set +x on it"
fi
else
+zinit-message "{e} linkbin annex: Failed to create {obj}$fnam{rst} link"
+zi-log "{e} {b}linkbin annex{rst}: Failed to create {file}$fnam{rst} link"
fi
done
done
)
fi

# vim: set expandtab filetype=zsh shiftwidth=4 softtabstop=4 tabstop=4:
# vim: set expandtab filetype=zsh shiftwidth=4 softtabstop=4 tabstop=4:
27 changes: 17 additions & 10 deletions :za-lb-atdelete-handler
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,27 @@
# Modified work Copyright (c) 2020-2021 Nicholas Serrano
# Modified work Copyright (c) 2022 zdharma-continuum and contributors

emulate -RL zsh
setopt extendedglob warncreateglobal typesetsilent noshortloops nullglob


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[sbin]} || ${+ZINIT_ICE[sbin]} )); then
+zi-log -n '{dbg}' "{b}linkbin annex{rst}: {ice}sbin{rst} ice detected, not doing anything"
return
fi
if (( ${+ICE[lbin]} ))
then
(( ${+ICE[sbin]} )) && {
(( !OPTS[opt_-q,--quiet] )) && +zinit-message "{m} linkbin annex: {ice}sbin{warn} ice detected, not doing anything...{rst}"

if (( ${+ICE[sbin]} || ${+ZINIT_ICE[sbin]} )); then
+zi-log -n '{dbg}' '{b}linkbin annex{rst}: {ice}sbin{rst} ice detected, not doing anything'
return
}
fi
emulate -RL zsh
setopt extendedglob warncreateglobal typesetsilent noshortloops
local -a lbins srcdst
lbins=(${(s.;.)ICE2[lbin]})
local lbin sym="-P"
Expand All @@ -43,7 +50,7 @@ then
(7) [[ -n $plugin ]] && files=($dir/**/$plugin(Nnon.)) ;;
(8) [[ -n $url ]] && files=($dir/**/${url:t}(Nnon.)) ;;
(9) files=($dir/**/*(*Nnon.:t)) ;;
(10) +zinit-message "{e} linkbin annex: The automatic-empty {ice}lbin{rst} ice didn't find any executable files" ;;
(10) +zi-log "{e} {b}linkbin annex{rst}: {ice}lbin{rst} ice did not detect any executable files" ;;
esac
done
[[ $i -gt 9 ]] && break
Expand All @@ -65,7 +72,7 @@ then
fi
if (( !${#fnames} ))
then
+zinit-message "{e} linkbin annex: The {ice}lbin{rst} ice ({glob}$lbin{rst}) did not match any files"
+zi-log "{e} {b}linkbin annex{rst}: The {ice}lbin{rst} ice ({glob}$lbin{rst}) did not match any files"
continue
fi
for fname in $fnames
Expand All @@ -78,12 +85,12 @@ then
command rm "$file"
if ! [[ -f $file ]]
then
(( !OPTS[opt_-q,--quiet] )) && +zinit-message "{m} linkbin annex: Deleted {obj}$fnam{rst} ${${${sym#-P}:+soft}:-hard} link"
(( !OPTS[opt_-q,--quiet] )) && +zi-log "{m} {b}linkbin annex{rst}: Deleted {file}$fnam{rst} ${${${sym#-P}:+soft}:-hard} link"
else
+zinit-message "{e} linkbin annex: Failed to delete {obj}$fnam{rst} link"
+zi-log "{e} {b}linkbin annex{rst}: Failed to delete {file}$fnam{rst} link"
fi
else
+zinit-message "{w} linkbin annex: {obj}$fnam{rst} ${${${sym#-P}:+soft}:-hard} link not found in \$ZPFX/bin"
+zi-log "{w} {b}linkbin annex{rst}: {file}$fnam{rst} ${${${sym#-P}:+soft}:-hard} link not found in \$ZPFX/bin"
fi
done
done
Expand Down

0 comments on commit da2c26f

Please sign in to comment.