mirror of
https://github.com/zdharma-continuum/zinit-annex-bin-gem-node.git
synced 2026-09-10 07:26:18 -04:00
*{atclone,atdelete}-handler,plugin.zsh: Automatic-empty sbin ice
This commit is contained in:
parent
5364435924
commit
b8fea5cc7a
|
|
@ -77,16 +77,35 @@ if [[ -n "${ZPLG_ICE[node]}" ]] {
|
|||
# sbin'' ice – creation of shims (the name borrowed from rbenv)
|
||||
#
|
||||
|
||||
if [[ -n "${ZPLG_ICE[sbin]}" ]] {
|
||||
if (( ${+ZPLG_ICE[sbin]} )) {
|
||||
local -a sbins srcdst
|
||||
sbins=( "${(s.;.)ZPLG_ICE[sbin]}" )
|
||||
sbins=( ${(s.;.)ZPLG_ICE[sbin]} )
|
||||
|
||||
local sbin
|
||||
|
||||
for sbin ( $sbins ) {
|
||||
for sbin ( $sbins "" ) {
|
||||
integer set_gem_home=0 set_node_path=0 set_cwd=0 \
|
||||
use_all_null=0 use_err_null=0 use_out_null=0
|
||||
|
||||
if [[ -z $sbin && ${#sbins} -eq 0 ]]; then
|
||||
if [[ -f $dir/${id_as:t} ]]; then
|
||||
sbin="$dir/${id_as:t}"
|
||||
elif [[ -n $plugin && -f $dir/$plugin ]]; then
|
||||
sbin="$dir/$plugin"
|
||||
elif [[ -n $url && -f $dir/${url:t} ]]; then
|
||||
sbin="$dir/${url:t}"
|
||||
else
|
||||
local -a files
|
||||
files=( $dir/*(*Non:t) )
|
||||
if (( ${#files} )); then
|
||||
sbin="${files[1]}"
|
||||
else
|
||||
print -P -- "%F{38}bin-gem-node annex: %F{160}The automatic-empty sbin ice didn't find any executable files%f"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
srcdst=( ${(@s.->.)sbin} )
|
||||
srcdst=( "${srcdst[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
|
||||
[[ ${srcdst[1]} = [gncNEO]#g[gncNEO]#:* ]] && set_gem_home=1
|
||||
|
|
|
|||
|
|
@ -14,14 +14,33 @@ local nl=$'\n'
|
|||
# sbin'' ice – creation of shims (the name borrowed from rbenv)
|
||||
#
|
||||
|
||||
if [[ -n "${ZPLG_ICE[sbin]}" ]] {
|
||||
if (( ${+ZPLG_ICE[sbin]} )) {
|
||||
local -a sbins srcdst
|
||||
sbins=( "${(s.;.)ZPLG_ICE[sbin]}" )
|
||||
sbins=( ${(s.;.)ZPLG_ICE[sbin]} )
|
||||
|
||||
local sbin
|
||||
integer set_gem_home set_node_path
|
||||
|
||||
for sbin ( $sbins ) {
|
||||
for sbin ( $sbins "" ) {
|
||||
if [[ -z $sbin && ${#sbins} -eq 0 ]]; then
|
||||
if [[ -f $dir/${id_as:t} ]]; then
|
||||
sbin="$dir/${id_as:t}"
|
||||
elif [[ -n $plugin && -f $dir/$plugin ]]; then
|
||||
sbin="$dir/$plugin"
|
||||
elif [[ -n $url && -f $dir/${url:t} ]]; then
|
||||
sbin="$dir/${url:t}"
|
||||
else
|
||||
local -a files
|
||||
files=( $dir/*(*Non:t) )
|
||||
if (( ${#files} )); then
|
||||
sbin="${files[1]}"
|
||||
else
|
||||
print -P -- "%F{38}bin-gem-node annex: %F{160}The automatic-empty sbin ice didn't find any executable files%f"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
srcdst=( ${(@s.->.)sbin} )
|
||||
srcdst=( "${srcdst[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
|
||||
[[ ${srcdst[1]} = (g|ng|gn):* ]] && set_gem_home=1 || set_gem_home=0
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ autoload .za-bgn-bin-or-src-function-body \
|
|||
hook:\!atload \
|
||||
:za-bgn-atload-handler \
|
||||
:za-bgn-help-handler \
|
||||
"fbin''|sbin''|gem''|node''|fmod''|fsrc''|ferc''" # also register new ices
|
||||
"fbin''|sbin|gem''|node''|fmod''|fsrc''|ferc''" # also register new ices
|
||||
|
||||
@zplg-register-annex "z-a-bin-gem-node" \
|
||||
hook:atclone \
|
||||
|
|
|
|||
Loading…
Reference in a new issue