mirror of
https://github.com/zdharma-continuum/zinit.git
synced 2026-09-10 07:36:38 -04:00
PROJECT RENAME Zplugin → Zinit. Hold your thumbs that everything will
work seamlessly.
This commit is contained in:
parent
a80e2a58d8
commit
1ca8f6856c
|
|
@ -1,4 +1,4 @@
|
|||
#compdef zplugin
|
||||
#compdef zinit
|
||||
|
||||
setopt localoptions warncreateglobal typesetsilent
|
||||
|
||||
|
|
@ -7,9 +7,9 @@ local -a expl
|
|||
|
||||
typeset -a commands
|
||||
commands=(
|
||||
zstatus:'overall Zplugin status'
|
||||
zstatus:'overall Zinit status'
|
||||
times:'statistics on plugin loading times'
|
||||
self-update:'updates Zplugin'
|
||||
self-update:'updates Zinit'
|
||||
help:'usage information'
|
||||
man:'manual'
|
||||
env-whitelist:'specify names (also patterns) of parameters to be left unchanged during an unload'
|
||||
|
|
@ -52,10 +52,10 @@ commands=(
|
|||
cdreplay:'replay compdefs (to be done after compinit)'
|
||||
cdclear:'clear compdef replay list'
|
||||
srv:'control a service, command can be: stop,start,restart,next,quit; `next'' moves the service to another Zshell'
|
||||
recall:'fetch saved ice modifiers and construct `zplugin ice ...'' command'
|
||||
recall:'fetch saved ice modifiers and construct `zinit ice ...'' command'
|
||||
env-whitelist:'allows to specify names (also patterns) of variables left unchanged during an unload. -v - verbose'
|
||||
bindkeys:'lists bindkeys set up by each plugin'
|
||||
module:'manage binary Zsh module shipped with Zplugin, see `zplugin module help'''
|
||||
module:'manage binary Zsh module shipped with Zinit, see `zinit module help'''
|
||||
run:"execute code inside plugin's folder"
|
||||
{add-fpath,fpath}:'add plugin folder to $fpath'
|
||||
)
|
||||
|
|
@ -66,7 +66,7 @@ _arguments -C \
|
|||
|
||||
case $state in
|
||||
command)
|
||||
_describe -t commands "Zplugin command" commands && ret=0
|
||||
_describe -t commands "Zinit command" commands && ret=0
|
||||
;;
|
||||
|
||||
argument)
|
||||
|
|
@ -89,9 +89,9 @@ case $state in
|
|||
|
||||
load|light)
|
||||
typeset -a plugins
|
||||
plugins=( "${ZPLGM[PLUGINS_DIR]}"/*(N:t) )
|
||||
plugins=( "${ZINIT[PLUGINS_DIR]}"/*(N:t) )
|
||||
plugins=( "${plugins[@]//---//}" )
|
||||
plugins=( "${plugins[@]:#_local/zplugin}" )
|
||||
plugins=( "${plugins[@]:#_local/zinit}" )
|
||||
plugins=( "${plugins[@]:#custom}" )
|
||||
|
||||
_alternative \
|
||||
|
|
@ -102,9 +102,9 @@ case $state in
|
|||
|
||||
run|fpath|add-fpath)
|
||||
typeset -a plugins
|
||||
plugins=( "${ZPLGM[PLUGINS_DIR]}"/*(N:t) )
|
||||
plugins=( "${ZINIT[PLUGINS_DIR]}"/*(N:t) )
|
||||
plugins=( "${plugins[@]//---//}" )
|
||||
plugins=( "${plugins[@]:#_local/zplugin}" )
|
||||
plugins=( "${plugins[@]:#_local/zinit}" )
|
||||
plugins=( "${plugins[@]:#custom}" )
|
||||
|
||||
local -a opts
|
||||
|
|
@ -124,22 +124,22 @@ case $state in
|
|||
compile|stress|edit|glance|recall|update|status|cd|changes|delete)
|
||||
# Plugins
|
||||
typeset -a plugins
|
||||
plugins=( "${ZPLGM[PLUGINS_DIR]}"/*(N:t) )
|
||||
plugins=( "${ZINIT[PLUGINS_DIR]}"/*(N:t) )
|
||||
plugins=( "${plugins[@]//---//}" )
|
||||
plugins=( "${plugins[@]:#_local/zplugin}" )
|
||||
plugins=( "${plugins[@]:#_local/zinit}" )
|
||||
plugins=( "${plugins[@]:#custom}" )
|
||||
|
||||
# Snippets
|
||||
local -a snippets snippets_alreadyld
|
||||
local sni
|
||||
|
||||
snippets=( "${ZPLGM[SNIPPETS_DIR]}"/**/._zplugin(D/:h) )
|
||||
snippets=( ${snippets[@]#${ZPLGM[SNIPPETS_DIR]}/} )
|
||||
snippets=( "${ZINIT[SNIPPETS_DIR]}"/**/._zinit(D/:h) )
|
||||
snippets=( ${snippets[@]#${ZINIT[SNIPPETS_DIR]}/} )
|
||||
snippets=( ${snippets[@]/(#b)(http|https|ftp|ftps|scp)--/${match[1]}://} )
|
||||
snippets=( ${snippets[@]/--//} )
|
||||
|
||||
for sni ( ${snippets[@]} ) {
|
||||
if [[ -n ${ZPLG_SNIPPETS[$sni]} ]]; then
|
||||
if [[ -n ${ZINIT_SNIPPETS[$sni]} ]]; then
|
||||
snippets_alreadyld+=( $sni )
|
||||
snippets=( ${snippets[@]:#$sni} )
|
||||
fi
|
||||
|
|
@ -153,7 +153,7 @@ case $state in
|
|||
|
||||
unload|report)
|
||||
typeset -a plugins absolute normal
|
||||
plugins=( "${ZPLG_REGISTERED_PLUGINS[@]:#_local/zplugin}" )
|
||||
plugins=( "${ZINIT_REGISTERED_PLUGINS[@]:#_local/zinit}" )
|
||||
normal=( "${plugins[@]:#%*}" )
|
||||
absolute=( "${(M)plugins[@]:#%*}" )
|
||||
absolute=( "${absolute[@]/\%\/\//%/}" )
|
||||
|
|
@ -185,7 +185,7 @@ case $state in
|
|||
cdisable)
|
||||
# Find enabled completions
|
||||
typeset -a completions
|
||||
completions=( "${ZPLGM[COMPLETIONS_DIR]}"/_*(N:t) )
|
||||
completions=( "${ZINIT[COMPLETIONS_DIR]}"/_*(N:t) )
|
||||
completions=( "${completions[@]#_}" )
|
||||
_wanted plugins expl "-- Completion --" \
|
||||
compadd "$@" -a - completions && \
|
||||
|
|
@ -195,7 +195,7 @@ case $state in
|
|||
cenable)
|
||||
# Find disabled
|
||||
typeset -a completions
|
||||
completions=( "${ZPLGM[COMPLETIONS_DIR]}"/[^_]*(N:t) )
|
||||
completions=( "${ZINIT[COMPLETIONS_DIR]}"/[^_]*(N:t) )
|
||||
_wanted plugins expl "-- Completion --" \
|
||||
compadd "$@" -a - completions && \
|
||||
ret=0
|
||||
|
|
@ -207,7 +207,7 @@ case $state in
|
|||
# for completions that can be installed
|
||||
typeset -a plugins completions
|
||||
local p c user plugin
|
||||
for p in "${ZPLGM[PLUGINS_DIR]}"/*; do
|
||||
for p in "${ZINIT[PLUGINS_DIR]}"/*; do
|
||||
completions=( "$p"/**/_[^_.][^.]#(N) )
|
||||
for c in "${completions[@]}"; do
|
||||
p="${p:t}"
|
||||
|
|
@ -228,13 +228,13 @@ case $state in
|
|||
# it has completions that are installed
|
||||
typeset -a plugins completions
|
||||
local p c user plugin
|
||||
for p in "${ZPLGM[PLUGINS_DIR]}"/*; do
|
||||
for p in "${ZINIT[PLUGINS_DIR]}"/*; do
|
||||
completions=( "$p"/**/_[^_.][^.]#(N) )
|
||||
for c in "${completions[@]}"; do
|
||||
cfile="${c:t}"
|
||||
bkpfile="${cfile#_}"
|
||||
# Completion installed, either enabled or disabled?
|
||||
if [[ -e "${ZPLGM[COMPLETIONS_DIR]}"/"$cfile" || -e "${ZPLGM[COMPLETIONS_DIR]}"/"$bkpfile" ]]; then
|
||||
if [[ -e "${ZINIT[COMPLETIONS_DIR]}"/"$cfile" || -e "${ZINIT[COMPLETIONS_DIR]}"/"$bkpfile" ]]; then
|
||||
p="${p:t}"
|
||||
user="${p%%---*}"
|
||||
plugin="${p#*---}"
|
||||
|
|
@ -257,13 +257,13 @@ case $state in
|
|||
local -a snippets snippets_alreadyld
|
||||
local sni
|
||||
|
||||
snippets=( "${ZPLGM[SNIPPETS_DIR]}"/**/._zplugin(D/:h) )
|
||||
snippets=( ${snippets[@]#${ZPLGM[SNIPPETS_DIR]}/} )
|
||||
snippets=( "${ZINIT[SNIPPETS_DIR]}"/**/._zinit(D/:h) )
|
||||
snippets=( ${snippets[@]#${ZINIT[SNIPPETS_DIR]}/} )
|
||||
snippets=( ${snippets[@]/(#b)(http|https|ftp|ftps|scp)--/${match[1]}://} )
|
||||
snippets=( ${snippets[@]/--//} )
|
||||
|
||||
for sni ( ${snippets[@]} ) {
|
||||
if [[ -n ${ZPLG_SNIPPETS[$sni]} ]]; then
|
||||
if [[ -n ${ZINIT_SNIPPETS[$sni]} ]]; then
|
||||
snippets_alreadyld+=( $sni )
|
||||
snippets=( ${snippets[@]:#$sni} )
|
||||
fi
|
||||
|
|
@ -301,14 +301,14 @@ case $state in
|
|||
|
||||
uncompile)
|
||||
typeset -a plugins
|
||||
plugins=( "${ZPLGM[PLUGINS_DIR]}"/*(N) )
|
||||
plugins=( "${ZINIT[PLUGINS_DIR]}"/*(N) )
|
||||
|
||||
typeset -a show_plugins p matches
|
||||
for p in "${plugins[@]}"; do
|
||||
matches=( $p/*.zwc(N) )
|
||||
if [ "$#matches" -ne "0" ]; then
|
||||
p="${p:t}"
|
||||
[ "$p" = "_local---zplugin" ] && continue
|
||||
[ "$p" = "_local---zinit" ] && continue
|
||||
[ "$p" = "custom" ] && continue
|
||||
p="${p//---//}"
|
||||
show_plugins+=( "$p" )
|
||||
|
|
@ -9,8 +9,8 @@
|
|||
.zcalc_history
|
||||
|
||||
# A popular plugin manager's files
|
||||
._zplugin
|
||||
.zplugin_lstupd
|
||||
._zinit
|
||||
.zinit_lastupd
|
||||
|
||||
# zdharma/zshelldoc tool's files
|
||||
zsdoc/data
|
||||
|
|
|
|||
|
|
@ -4,17 +4,19 @@
|
|||
# Clone or pull
|
||||
#
|
||||
|
||||
if [ -z "$ZPLG_HOME" ]; then
|
||||
ZPLG_HOME="${ZDOTDIR:-$HOME}/.zplugin"
|
||||
ZINIT_HOME="${ZINIT_HOME:-$ZPLG_HOME}"
|
||||
if [ -z "$ZINIT_HOME" ]; then
|
||||
ZINIT_HOME="${ZDOTDIR:-$HOME}/.zinit"
|
||||
fi
|
||||
|
||||
if [ -z "$ZPLG_BIN_DIR_NAME" ]; then
|
||||
ZPLG_BIN_DIR_NAME="bin"
|
||||
ZINIT_BIN_DIR_NAME="${ZINIT_BIN_DIR_NAME:-$ZPLG_BIN_DIR_NAME}"
|
||||
if [ -z "$ZINIT_BIN_DIR_NAME" ]; then
|
||||
ZINIT_BIN_DIR_NAME="bin"
|
||||
fi
|
||||
|
||||
if ! test -d "$ZPLG_HOME"; then
|
||||
mkdir "$ZPLG_HOME"
|
||||
chmod g-rwX "$ZPLG_HOME"
|
||||
if ! test -d "$ZINIT_HOME"; then
|
||||
mkdir "$ZINIT_HOME"
|
||||
chmod g-rwX "$ZINIT_HOME"
|
||||
fi
|
||||
|
||||
if ! command -v git >/dev/null 2>&1; then
|
||||
|
|
@ -24,34 +26,34 @@ fi
|
|||
|
||||
# Get the download-progress bar tool
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
mkdir -p /tmp/zplugin
|
||||
cd /tmp/zplugin
|
||||
curl -fsSLO https://raw.githubusercontent.com/zdharma/zplugin/master/git-process-output.zsh && \
|
||||
chmod +x /tmp/zplugin/git-process-output.zsh
|
||||
mkdir -p /tmp/zinit
|
||||
cd /tmp/zinit
|
||||
curl -fsSLO https://raw.githubusercontent.com/zdharma/zinit/master/git-process-output.zsh && \
|
||||
chmod +x /tmp/zinit/git-process-output.zsh
|
||||
elif command -v wget >/dev/null 2>&1; then
|
||||
mkdir -p /tmp/zplugin
|
||||
cd /tmp/zplugin
|
||||
wget -q https://raw.githubusercontent.com/zdharma/zplugin/master/git-process-output.zsh && \
|
||||
chmod +x /tmp/zplugin/git-process-output.zsh
|
||||
mkdir -p /tmp/zinit
|
||||
cd /tmp/zinit
|
||||
wget -q https://raw.githubusercontent.com/zdharma/zinit/master/git-process-output.zsh && \
|
||||
chmod +x /tmp/zinit/git-process-output.zsh
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "[1;34m▓▒░[0m Installing zplugin at [1;35m$ZPLG_HOME/$ZPLG_BIN_DIR_NAME[0m"
|
||||
if test -d "$ZPLG_HOME/$ZPLG_BIN_DIR_NAME/.git"; then
|
||||
cd "$ZPLG_HOME/$ZPLG_BIN_DIR_NAME"
|
||||
echo "[1;34m▓▒░[0m Installing [1;33mDHARMA Initiative Plugin Manager[0m at [1;35m$ZINIT_HOME/$ZINIT_BIN_DIR_NAME[0m"
|
||||
if test -d "$ZINIT_HOME/$ZINIT_BIN_DIR_NAME/.git"; then
|
||||
cd "$ZINIT_HOME/$ZINIT_BIN_DIR_NAME"
|
||||
git pull origin master
|
||||
else
|
||||
cd "$ZPLG_HOME"
|
||||
{ git clone --progress https://github.com/zdharma/zplugin.git "$ZPLG_BIN_DIR_NAME" \
|
||||
2>&1 | { /tmp/zplugin/git-process-output.zsh || cat; } } 2>/dev/null
|
||||
if [ -d "$ZPLG_BIN_DIR_NAME" ]; then
|
||||
cd "$ZINIT_HOME"
|
||||
{ git clone --progress https://github.com/zdharma/zinit.git "$ZINIT_BIN_DIR_NAME" \
|
||||
2>&1 | { /tmp/zinit/git-process-output.zsh || cat; } } 2>/dev/null
|
||||
if [ -d "$ZINIT_BIN_DIR_NAME" ]; then
|
||||
echo
|
||||
echo "[1;34m▓▒░[0m Zplugin succesfully installed at [1;32m$ZPLG_HOME/$ZPLG_BIN_DIR_NAME[0m"
|
||||
VERSION="$(cat "$ZPLG_HOME/$ZPLG_BIN_DIR_NAME/.git/refs/heads/master" | cut -c1-10)"
|
||||
echo "[1;34m▓▒░[0m Zinit succesfully installed at [1;32m$ZINIT_HOME/$ZINIT_BIN_DIR_NAME[0m"
|
||||
VERSION="$(cat "$ZINIT_HOME/$ZINIT_BIN_DIR_NAME/.git/refs/heads/master" | cut -c1-10)"
|
||||
echo "[1;34m▓▒░[0m Version: [1;32m$VERSION[0m"
|
||||
else
|
||||
echo
|
||||
echo "[1;31m▓▒░[0m Something went wrong, couldn't install Zplugin at [1;33m$ZPLG_HOME/$ZPLG_BIN_DIR_NAME[0m"
|
||||
echo "[1;31m▓▒░[0m Something went wrong, couldn't install Zinit at [1;33m$ZINIT_HOME/$ZINIT_BIN_DIR_NAME[0m"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
@ -59,26 +61,26 @@ fi
|
|||
# Modify .zshrc
|
||||
#
|
||||
THE_ZDOTDIR="${ZDOTDIR:-$HOME}"
|
||||
if grep zplugin "$THE_ZDOTDIR/.zshrc" >/dev/null 2>&1; then
|
||||
if grep zinit\\.zsh "$THE_ZDOTDIR/.zshrc" >/dev/null 2>&1; then
|
||||
echo "[34m▓▒░[0m .zshrc already updated, not making changes"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "[34m▓▒░[0m Updating $THE_ZDOTDIR/.zshrc (10 lines of code, at the bottom)"
|
||||
ZPLG_HOME="$(echo $ZPLG_HOME | sed "s|$HOME|\$HOME|")"
|
||||
ZINIT_HOME="$(echo $ZINIT_HOME | sed "s|$HOME|\$HOME|")"
|
||||
cat <<-EOF >> "$THE_ZDOTDIR/.zshrc"
|
||||
|
||||
### Added by Zplugin's installer
|
||||
if [[ ! -d $ZPLG_HOME/$ZPLG_BIN_DIR_NAME ]]; then
|
||||
print -P "%F{33}▓▒░ %F{220}Installing Zplugin…%f"
|
||||
command mkdir -p $ZPLG_HOME
|
||||
command git clone https://github.com/zdharma/zplugin $ZPLG_HOME/$ZPLG_BIN_DIR_NAME && \\
|
||||
### Added by Zinit's installer
|
||||
if [[ ! -f $ZINIT_HOME/$ZINIT_BIN_DIR_NAME/zinit.zsh ]]; then
|
||||
print -P "%F{33}▓▒░ %F{220}Installing DHARMA Initiative Plugin Manager (zdharma/zinit)…%f"
|
||||
command mkdir -p $ZINIT_HOME
|
||||
command git clone https://github.com/zdharma/zinit $ZINIT_HOME/$ZINIT_BIN_DIR_NAME && \\
|
||||
print -P "%F{33}▓▒░ %F{34}Installation successful.%F" || \\
|
||||
print -P "%F{160}▓▒░ The clone has failed.%F"
|
||||
fi
|
||||
source "$ZPLG_HOME/$ZPLG_BIN_DIR_NAME/zplugin.zsh"
|
||||
autoload -Uz _zplugin
|
||||
(( \${+_comps} )) && _comps[zplugin]=_zplugin
|
||||
### End of Zplugin installer's chunk
|
||||
source "$ZINIT_HOME/$ZINIT_BIN_DIR_NAME/zinit.zsh"
|
||||
autoload -Uz _zinit
|
||||
(( \${+_comps} )) && _comps[zinit]=_zinit
|
||||
### End of Zinit installer's chunk
|
||||
EOF
|
||||
echo "[34m▓▒░[0m Done"
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,12 +1,12 @@
|
|||
# -*- mode: sh; sh-indentation: 4; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# Copyright (c) 2019 Sebastian Gniazdowski and contributors
|
||||
|
||||
# FUNCTION: -zplg-shands-exp {{{
|
||||
# FUNCTION: .zinit-shands-exp <<<
|
||||
# Does expansion of currently little unstandarized
|
||||
# shorthands like "%SNIPPETS", "%HOME", "OMZ::", "PZT::".
|
||||
-zplg-shands-exp() {
|
||||
.zinit-shands-exp() {
|
||||
REPLY="$1$2"
|
||||
REPLY="${${${REPLY/\%HOME/$HOME}/\%SNIPPETS/${ZPLGM[SNIPPETS_DIR]}}#%}"
|
||||
REPLY="${${${REPLY/\%HOME/$HOME}/\%SNIPPETS/${ZINIT[SNIPPETS_DIR]}}#%}"
|
||||
#REPLY="${REPLY/OMZ::/https--github.com--robbyrussell--oh-my-zsh--trunk--}"
|
||||
#REPLY="${REPLY/\/OMZ//https--github.com--robbyrussell--oh-my-zsh--trunk}"
|
||||
#REPLY="${REPLY/PZT::/https--github.com--sorin-ionescu--prezto--trunk--}"
|
||||
|
|
@ -15,28 +15,28 @@
|
|||
# Testable
|
||||
[[ "$REPLY" != "$1$2" ]]
|
||||
}
|
||||
# }}}
|
||||
# FUNCTION: -zplg-exists-physically {{{
|
||||
# >>>
|
||||
# FUNCTION: .zinit-exists-physically <<<
|
||||
# Checks if directory of given plugin exists in PLUGIN_DIR.
|
||||
#
|
||||
# Testable.
|
||||
#
|
||||
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
|
||||
# $2 - plugin (only when $1 - i.e. user - given)
|
||||
-zplg-exists-physically() {
|
||||
-zplg-any-to-user-plugin "$1" "$2"
|
||||
.zinit-exists-physically() {
|
||||
.zinit-any-to-user-plugin "$1" "$2"
|
||||
if [[ "${reply[-2]}" = "%" ]]; then
|
||||
# Shorthands, little unstandarized
|
||||
-zplg-shands-exp "$1" "$2" && {
|
||||
.zinit-shands-exp "$1" "$2" && {
|
||||
[[ -d "$REPLY" ]] && return 0 || return 1
|
||||
} || {
|
||||
[[ -d "${reply[-1]}" ]] && return 0 || return 1
|
||||
}
|
||||
else
|
||||
[[ -d "${ZPLGM[PLUGINS_DIR]}/${reply[-2]:+${reply[-2]}---}${reply[-1]//\//---}" ]] && return 0 || return 1
|
||||
[[ -d "${ZINIT[PLUGINS_DIR]}/${reply[-2]:+${reply[-2]}---}${reply[-1]//\//---}" ]] && return 0 || return 1
|
||||
fi
|
||||
} # }}}
|
||||
# FUNCTION: -zplg-exists-physically-message {{{
|
||||
} # >>>
|
||||
# FUNCTION: .zinit-exists-physically-message <<<
|
||||
# Checks if directory of given plugin exists in PLUGIN_DIR,
|
||||
# and outputs error message if it doesn't.
|
||||
#
|
||||
|
|
@ -44,56 +44,56 @@
|
|||
#
|
||||
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
|
||||
# $2 - plugin (only when $1 - i.e. user - given)
|
||||
-zplg-exists-physically-message() {
|
||||
if ! -zplg-exists-physically "$1" "$2"; then
|
||||
-zplg-any-colorify-as-uspl2 "$1" "$2"
|
||||
.zinit-exists-physically-message() {
|
||||
if ! .zinit-exists-physically "$1" "$2"; then
|
||||
.zinit-any-colorify-as-uspl2 "$1" "$2"
|
||||
local spec="$REPLY"
|
||||
|
||||
-zplg-shands-exp "$1" "$2" && REPLY="${REPLY/$HOME/~}"
|
||||
.zinit-shands-exp "$1" "$2" && REPLY="${REPLY/$HOME/~}"
|
||||
|
||||
print -r -- "${ZPLGM[col-error]}No such (plugin or snippet) directory${ZPLGM[col-rst]}: $spec"
|
||||
print -r -- "${ZINIT[col-error]}No such (plugin or snippet) directory${ZINIT[col-rst]}: $spec"
|
||||
[[ "$REPLY" != "$1$2" ]] && print -r -- "(expands to: $REPLY)"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
} # }}}
|
||||
# FUNCTION: -zplg-plgdir {{{
|
||||
-zplg-get-plg-dir() {
|
||||
} # >>>
|
||||
# FUNCTION: .zinit-plgdir <<<
|
||||
.zinit-get-plg-dir() {
|
||||
# There are plugins having ".plugin.zsh"
|
||||
# in ${plugin} directory name, also some
|
||||
# have ".zsh" there
|
||||
local dname="${ZPLGM[alias-map-${user:+${user}/}$plugin]}"
|
||||
local dname="${ZINIT[alias-map-${user:+${user}/}$plugin]}"
|
||||
local pdir="${${${${plugin:t}%.plugin.zsh}%.zsh}%.git}"
|
||||
[[ -z "$dname" ]] && {
|
||||
[[ "$user" = "%" ]] && dname="$plugin" || \
|
||||
dname="${ZPLGM[PLUGINS_DIR]}/${user:+${user}---}${plugin//\//---}"
|
||||
dname="${ZINIT[PLUGINS_DIR]}/${user:+${user}---}${plugin//\//---}"
|
||||
}
|
||||
|
||||
reply=( "$dname" "$pdir" )
|
||||
return 0
|
||||
}
|
||||
# }}}
|
||||
# FUNCTION: -zplg-first {{{
|
||||
# >>>
|
||||
# FUNCTION: .zinit-first <<<
|
||||
# Finds the main file of plugin. There are multiple file name
|
||||
# formats, they are ordered in order starting from more correct
|
||||
# ones, and matched. -zplg-load-plugin() has similar code parts
|
||||
# and doesn't call -zplg-first() – for performance. Obscure matching
|
||||
# is done in -zplg-find-other-matches, here and in -zplg-load().
|
||||
# ones, and matched. .zinit-load-plugin() has similar code parts
|
||||
# and doesn't call .zinit-first() – for performance. Obscure matching
|
||||
# is done in .zinit-find-other-matches, here and in .zinit-load().
|
||||
# Obscure = non-standard main-file naming convention.
|
||||
#
|
||||
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
|
||||
# $2 - plugin (only when $1 - i.e. user - given)
|
||||
-zplg-first() {
|
||||
-zplg-any-to-user-plugin "$1" "$2"
|
||||
.zinit-first() {
|
||||
.zinit-any-to-user-plugin "$1" "$2"
|
||||
local user="${reply[-2]}" plugin="${reply[-1]}"
|
||||
|
||||
-zplg-get-plg-dir "$user" "$plugin"
|
||||
.zinit-get-plg-dir "$user" "$plugin"
|
||||
local dname="${reply[-2]}"
|
||||
|
||||
# Look for file to compile. First look for the most common one
|
||||
# (optimization) then for other possibilities
|
||||
if [[ ! -e "$dname/${reply[-1]}.plugin.zsh" ]]; then
|
||||
-zplg-find-other-matches "$dname" "${reply[-1]}"
|
||||
.zinit-find-other-matches "$dname" "${reply[-1]}"
|
||||
else
|
||||
reply=( "$dname/${reply[-1]}.plugin.zsh" )
|
||||
fi
|
||||
|
|
@ -106,32 +106,32 @@
|
|||
# Take first entry (ksharrays resilience)
|
||||
reply=( "$dname" "${reply[-${#reply}]}" )
|
||||
return 0
|
||||
} # }}}
|
||||
# FUNCTION: -zplg-any-colorify-as-uspl2 {{{
|
||||
} # >>>
|
||||
# FUNCTION: .zinit-any-colorify-as-uspl2 <<<
|
||||
# Returns ANSI-colorified "user/plugin" string, from any supported
|
||||
# plugin spec (user---plugin, user/plugin, user plugin, plugin).
|
||||
#
|
||||
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
|
||||
# $2 - plugin (only when $1 - i.e. user - given)
|
||||
# $REPLY = ANSI-colorified "user/plugin" string
|
||||
-zplg-any-colorify-as-uspl2() {
|
||||
-zplg-any-to-user-plugin "$1" "$2"
|
||||
.zinit-any-colorify-as-uspl2() {
|
||||
.zinit-any-to-user-plugin "$1" "$2"
|
||||
local user="${reply[-2]}" plugin="${reply[-1]}"
|
||||
[[ "$user" = "%" ]] && {
|
||||
plugin="${plugin/${ZPLGM[SNIPPETS_DIR]}/SNIPPETS}"
|
||||
plugin="${plugin/${ZINIT[SNIPPETS_DIR]}/SNIPPETS}"
|
||||
plugin="${plugin/https--github.com--robbyrussell--oh-my-zsh--trunk--/OMZ::}"
|
||||
plugin="${plugin/https--github.com--robbyrussell--oh-my-zsh--trunk/OMZ}"
|
||||
plugin="${plugin/https--github.com--sorin-ionescu--prezto--trunk--/PZT::}"
|
||||
plugin="${plugin/https--github.com--sorin-ionescu--prezto--trunk/PZT}"
|
||||
plugin="${plugin/$HOME/HOME}"
|
||||
REPLY="${ZPLGM[col-uname]}%${ZPLGM[col-rst]}${ZPLGM[col-pname]}${plugin}${ZPLGM[col-rst]}"
|
||||
} || REPLY="${user:+${ZPLGM[col-uname]}${user}${ZPLGM[col-rst]}/}${ZPLGM[col-pname]}${plugin}${ZPLGM[col-rst]}"
|
||||
} # }}}
|
||||
# FUNCTION: -zplg-two-paths {{{
|
||||
REPLY="${ZINIT[col-uname]}%${ZINIT[col-rst]}${ZINIT[col-pname]}${plugin}${ZINIT[col-rst]}"
|
||||
} || REPLY="${user:+${ZINIT[col-uname]}${user}${ZINIT[col-rst]}/}${ZINIT[col-pname]}${plugin}${ZINIT[col-rst]}"
|
||||
} # >>>
|
||||
# FUNCTION: .zinit-two-paths <<<
|
||||
# Obtains a snippet URL without specification if it is an SVN URL (points to
|
||||
# directory) or regular URL (points to file), returns 2 possible paths for
|
||||
# further examination
|
||||
-zplg-two-paths() {
|
||||
.zinit-two-paths() {
|
||||
setopt localoptions extendedglob nokshglob noksharrays noshwordsplit
|
||||
local url="$1" url1 url2 local_dirA svn_dirA local_dirB dirnameA dirnameB
|
||||
local -a fileB_there
|
||||
|
|
@ -140,48 +140,49 @@
|
|||
url="${${url#"${url%%[! $'\t']*}"}%/}"
|
||||
url1="$url" url2="$url"
|
||||
|
||||
#url1[1,5]="${ZPLG_1MAP[${url[1,5]}]:-${url[1,5]}}" # svn
|
||||
#url2[1,5]="${ZPLG_2MAP[${url[1,5]}]:-${url[1,5]}}" # normal
|
||||
#url1[1,5]="${ZINIT_1MAP[${url[1,5]}]:-${url[1,5]}}" # svn
|
||||
#url2[1,5]="${ZINIT_2MAP[${url[1,5]}]:-${url[1,5]}}" # normal
|
||||
|
||||
dirnameA="${${url1%%\?*}:t}"
|
||||
local_dirA="${${${url1%%\?*}:h}/:\/\//--}"
|
||||
[[ "$local_dirA" = "." ]] && local_dirA="" || local_dirA="${${${${${local_dirA#/}//\//--}//=/--EQ--}//\?/--QM--}//\&/--AMP--}"
|
||||
local_dirA="${ZPLGM[SNIPPETS_DIR]}${local_dirA:+/$local_dirA}"
|
||||
local_dirA="${ZINIT[SNIPPETS_DIR]}${local_dirA:+/$local_dirA}"
|
||||
[[ -d "$local_dirA/$dirnameA/.svn" ]] && svn_dirA=".svn"
|
||||
|
||||
dirnameB="${${url2%%\?*}:t}"
|
||||
local_dirB="${${${url2%%\?*}:h}/:\/\//--}"
|
||||
[[ "$local_dirB" = "." ]] && local_dirB="" || local_dirB="${${${${${local_dirB#/}//\//--}//=/--EQ--}//\?/--QM--}//\&/--AMP--}"
|
||||
local_dirB="${ZPLGM[SNIPPETS_DIR]}${local_dirB:+/$local_dirB}"
|
||||
local_dirB="${ZINIT[SNIPPETS_DIR]}${local_dirB:+/$local_dirB}"
|
||||
fileB_there=( "$local_dirB/$dirnameB"/*~*.zwc(.DOnN[1]) )
|
||||
|
||||
reply=( "$local_dirA/$dirnameA" "$svn_dirA" "$local_dirB/$dirnameB" "${fileB_there[1]##$local_dirB/$dirnameB/#}" )
|
||||
}
|
||||
# }}}
|
||||
# FUNCTION: -zplg-compute-ice {{{
|
||||
# Computes ZPLG_ICE array (default, it can be specified via $3) from a) input
|
||||
# ZPLG_ICE, b) static ice, c) saved ice, taking priorities into account. Also
|
||||
# >>>
|
||||
# FUNCTION: .zinit-compute-ice <<<
|
||||
# Computes ZINIT_ICE array (default, it can be specified via $3) from a) input
|
||||
# ZINIT_ICE, b) static ice, c) saved ice, taking priorities into account. Also
|
||||
# returns path to snippet directory and optional name of snippet file (only
|
||||
# valid if ZPLG_ICE[svn] is not set).
|
||||
# valid if ZINIT_ICE[svn] is not set).
|
||||
#
|
||||
# Can also pack resulting ices into ZPLG_SICE (see $2).
|
||||
# Can also pack resulting ices into ZINIT_SICE (see $2).
|
||||
#
|
||||
# $1 - URL (also plugin-spec)
|
||||
# $2 - "pack" or "nopack" or "pack-nf" - packing means ZPLG_ICE
|
||||
# $2 - "pack" or "nopack" or "pack-nf" - packing means ZINIT_ICE
|
||||
# wins with static ice; "pack-nf" means that disk-ices will
|
||||
# be ignored (no-file?)
|
||||
# $3 - name of output associative array, "ZPLG_ICE" is the default
|
||||
# $3 - name of output associative array, "ZINIT_ICE" is the default
|
||||
# $4 - name of output string parameter, to hold path to directory ("local_dir")
|
||||
# $5 - name of output string parameter, to hold filename ("filename")
|
||||
# $6 - name of output string parameter, to hold is-snippet 0/1-bool ("is_snippet")
|
||||
-zplg-compute-ice() {
|
||||
setopt localoptions extendedglob nokshglob noksharrays
|
||||
.zinit-compute-ice() {
|
||||
emulate -LR zsh
|
||||
setopt extendedglob typesetsilent warncreateglobal noshortloops
|
||||
|
||||
local __URL="${1%/}" __pack="$2" __is_snippet=0
|
||||
local __var_name1="${3:-ZPLG_ICE}" __var_name2="${4:-local_dir}" \
|
||||
local __var_name1="${3:-ZINIT_ICE}" __var_name2="${4:-local_dir}" \
|
||||
__var_name3="${5:-filename}" __var_name4="${6:-is_snippet}"
|
||||
|
||||
# Copy from -zplg-recall
|
||||
# Copy from .zinit-recall
|
||||
local -a ice_order nval_ices
|
||||
ice_order=(
|
||||
svn proto from teleid bindmap cloneopts id-as depth if wait load
|
||||
|
|
@ -194,7 +195,7 @@
|
|||
subscribe param
|
||||
# Include all additional ices – after
|
||||
# stripping them from the possible: ''
|
||||
${(@us.|.)${ZPLG_EXTS[ice-mods]//\'\'/}}
|
||||
${(@us.|.)${ZINIT_EXTS[ice-mods]//\'\'/}}
|
||||
)
|
||||
nval_ices=(
|
||||
blockf silent lucid trackbinds cloneonly nocd run-atpull
|
||||
|
|
@ -204,7 +205,7 @@
|
|||
# Include only those additional ices,
|
||||
# don't have the '' in their name, i.e.
|
||||
# aren't designed to hold value
|
||||
${(@)${(@s.|.)ZPLG_EXTS[ice-mods]}:#*\'\'*}
|
||||
${(@)${(@s.|.)ZINIT_EXTS[ice-mods]}:#*\'\'*}
|
||||
|
||||
# Must be last
|
||||
svn
|
||||
|
|
@ -214,26 +215,26 @@
|
|||
__URL="${${__URL#"${__URL%%[! $'\t']*}"}%/}"
|
||||
|
||||
# Snippet?
|
||||
-zplg-two-paths "$__URL"
|
||||
.zinit-two-paths "$__URL"
|
||||
local __s_path="${reply[-4]}" __s_svn="${reply[-3]}" ___path="${reply[-2]}" __filename="${reply[-1]}" __local_dir
|
||||
if [[ -d "$__s_path" || -d "$___path" ]]; then
|
||||
__is_snippet=1
|
||||
else
|
||||
# Plugin
|
||||
-zplg-shands-exp "$__URL" && __URL="$REPLY"
|
||||
-zplg-any-to-user-plugin "$__URL" ""
|
||||
.zinit-shands-exp "$__URL" && __URL="$REPLY"
|
||||
.zinit-any-to-user-plugin "$__URL" ""
|
||||
local __user="${reply[-2]}" __plugin="${reply[-1]}"
|
||||
__s_path="" __filename=""
|
||||
[[ "$__user" = "%" ]] && ___path="$__plugin" || ___path="${ZPLGM[PLUGINS_DIR]}/${__user:+${__user}---}${__plugin//\//---}"
|
||||
-zplg-exists-physically-message "$__user" "$__plugin" || return 1
|
||||
[[ "$__user" = "%" ]] && ___path="$__plugin" || ___path="${ZINIT[PLUGINS_DIR]}/${__user:+${__user}---}${__plugin//\//---}"
|
||||
.zinit-exists-physically-message "$__user" "$__plugin" || return 1
|
||||
fi
|
||||
|
||||
[[ $__pack = pack* ]] && (( ${#ZPLG_ICE} > 0 )) && \
|
||||
-zplg-pack-ice "${__user-$__URL}" "$__plugin"
|
||||
[[ $__pack = pack* ]] && (( ${#ZINIT_ICE} > 0 )) && \
|
||||
.zinit-pack-ice "${__user-$__URL}" "$__plugin"
|
||||
|
||||
local -A __sice
|
||||
local -a __tmp
|
||||
__tmp=( "${(z@)ZPLG_SICE[$__user${${__user:#(%|/)*}:+/}$__plugin]}" )
|
||||
__tmp=( "${(z@)ZINIT_SICE[$__user${${__user:#(%|/)*}:+/}$__plugin]}" )
|
||||
(( ${#__tmp[@]} > 1 && ${#__tmp[@]} % 2 == 0 )) && __sice=( "${(Q)__tmp[@]}" )
|
||||
|
||||
if [[ "${+__sice[svn]}" = "1" || -n "$__s_svn" ]]; then
|
||||
|
|
@ -242,7 +243,7 @@
|
|||
print -r -- "(\`svn' can be used only with snippets)"
|
||||
return 1
|
||||
elif (( !__is_snippet )); then
|
||||
print -r -- "Undefined behavior #1 occurred, please report at https://github.com/zdharma/zplugin/issues"
|
||||
print -r -- "Undefined behavior #1 occurred, please report at https://github.com/zdharma/zinit/issues"
|
||||
return 1
|
||||
fi
|
||||
if [[ -e "$__s_path" && -n "$__s_svn" ]]; then
|
||||
|
|
@ -263,36 +264,50 @@
|
|||
fi
|
||||
fi
|
||||
|
||||
local __zplugin_path="$__local_dir/._zplugin"
|
||||
local __zinit_path="$__local_dir/._zinit"
|
||||
|
||||
# Zplugin -> Zinit rename upgrade code
|
||||
if [[ ! -d $__zinit_path && -d $__local_dir/._zplugin ]]; then
|
||||
(
|
||||
print -Pr -- "${ZINIT[col-pre]}UPGRADING THE DIRECTORY STRUCTURE" \
|
||||
"FOR THE ZPLUGIN -> ZINIT RENAME…%f"
|
||||
builtin cd -q ${ZINIT[PLUGINS_DIR]} || return 1
|
||||
autoload -Uz zmv
|
||||
( zmv -W '**/._zplugin' '**/._zinit' ) &>/dev/null
|
||||
builtin cd -q ${ZINIT[SNIPPETS_DIR]} || return 1
|
||||
( zmv -W '**/._zplugin' '**/._zinit' ) &>/dev/null
|
||||
print -Pr -- "${ZINIT[col-obj]}THE UPGRADE SUCCEDED!%f"
|
||||
) || print -Pr -- "${ZINIT[col-error]}THE UPGRADE FAILED!%f"
|
||||
fi
|
||||
|
||||
# Read disk-Ice
|
||||
local -A __mdata
|
||||
local __key
|
||||
{ for __key in mode url is_release ${ice_order[@]}; do
|
||||
[[ -f "$__zplugin_path/$__key" ]] && __mdata[$__key]="$(<$__zplugin_path/$__key)"
|
||||
[[ -f "$__zinit_path/$__key" ]] && __mdata[$__key]="$(<$__zinit_path/$__key)"
|
||||
done
|
||||
[[ "${__mdata[mode]}" = "1" ]] && __mdata[svn]=""
|
||||
} 2>/dev/null
|
||||
|
||||
# Handle flag-Ices; svn must be last
|
||||
for __key in ${ice_order[@]}; do
|
||||
(( 0 == ${+ZPLG_ICE[no$__key]} && 0 == ${+__sice[no$__key]} )) && continue
|
||||
(( 0 == ${+ZINIT_ICE[no$__key]} && 0 == ${+__sice[no$__key]} )) && continue
|
||||
# "If there is such ice currently, and there's no no* ice given,
|
||||
# and there's the no* ice in the static ice" – skip, don't unset.
|
||||
# With conjunction with the previous line this has the proper
|
||||
# meaning: uset if at least in one – current or static – ice
|
||||
# there's the no* ice, but not if it's only in the static ice
|
||||
# (unless there's on such ice "anyway").
|
||||
(( 1 == ${+ZPLG_ICE[$__key]} && 0 == ${+ZPLG_ICE[no$__key]} && \
|
||||
(( 1 == ${+ZINIT_ICE[$__key]} && 0 == ${+ZINIT_ICE[no$__key]} && \
|
||||
1 == ${+__sice[no$__key]} )) && continue
|
||||
|
||||
if [[ "$__key" = "svn" ]]; then
|
||||
command print -r -- "0" >! "$__zplugin_path/mode"
|
||||
command print -r -- "0" >! "$__zinit_path/mode"
|
||||
__mdata[mode]=0
|
||||
else
|
||||
command rm -f -- "$__zplugin_path/$__key"
|
||||
command rm -f -- "$__zinit_path/$__key"
|
||||
fi
|
||||
unset "__mdata[$__key]" "__sice[$__key]" "ZPLG_ICE[$__key]"
|
||||
unset "__mdata[$__key]" "__sice[$__key]" "ZINIT_ICE[$__key]"
|
||||
done
|
||||
|
||||
# Final decision, static ice vs. saved ice
|
||||
|
|
@ -313,8 +328,8 @@
|
|||
|
||||
return 0
|
||||
}
|
||||
# }}}
|
||||
# FUNCTION: -zplg-store-ices {{{
|
||||
# >>>
|
||||
# FUNCTION: .zinit-store-ices <<<
|
||||
# Saves ice mods in given hash onto disk.
|
||||
#
|
||||
# $1 - directory where to create / delete files
|
||||
|
|
@ -323,12 +338,12 @@
|
|||
# $4 - additional keys of hash to store, empty-meaningful ices, space separated
|
||||
# $5 – the URL, if applicable
|
||||
# $6 – the mode (1 - svn, 0 - single file), if applicable
|
||||
-zplg-store-ices() {
|
||||
.zinit-store-ices() {
|
||||
local __pfx="$1" __ice_var="$2" \
|
||||
__add_ices="$3" __add_ices2="$4" \
|
||||
url="$5" mode="$6"
|
||||
|
||||
# Copy from -zplg-recall
|
||||
# Copy from .zinit-recall
|
||||
local -a ice_order nval_ices
|
||||
ice_order=(
|
||||
svn proto from teleid bindmap cloneopts id-as depth if wait load
|
||||
|
|
@ -341,7 +356,7 @@
|
|||
subscribe param
|
||||
# Include all additional ices – after
|
||||
# stripping them from the possible: ''
|
||||
${(@s.|.)${ZPLG_EXTS[ice-mods]//\'\'/}}
|
||||
${(@s.|.)${ZINIT_EXTS[ice-mods]//\'\'/}}
|
||||
)
|
||||
nval_ices=(
|
||||
blockf silent lucid trackbinds cloneonly nocd run-atpull
|
||||
|
|
@ -351,7 +366,7 @@
|
|||
# Include only those additional ices,
|
||||
# don't have the '' in their name, i.e.
|
||||
# aren't designed to hold value
|
||||
${(@)${(@s.|.)ZPLG_EXTS[ice-mods]}:#*\'\'*}
|
||||
${(@)${(@s.|.)ZINIT_EXTS[ice-mods]}:#*\'\'*}
|
||||
|
||||
# Must be last
|
||||
svn
|
||||
|
|
@ -381,27 +396,27 @@
|
|||
[[ -n "${(P)__key}" ]] && print -r -- "${(P)__key}" >! "$__pfx"/"$__key"
|
||||
done
|
||||
}
|
||||
# }}}
|
||||
# FUNCTION: -zplg-countdown {{{
|
||||
# >>>
|
||||
# FUNCTION: .zinit-countdown <<<
|
||||
# Displays a countdown 5...4... etc. and returns 0 if it
|
||||
# sucessfully reaches 0, or 1 if Ctrl-C will be pressed.
|
||||
-zplg-countdown() {
|
||||
(( !${+ZPLG_ICE[countdown]} )) && return 0
|
||||
.zinit-countdown() {
|
||||
(( !${+ZINIT_ICE[countdown]} )) && return 0
|
||||
|
||||
emulate -L zsh
|
||||
trap "print \"${ZPLGM[col-pname]}ABORTING, the ice not ran${ZPLGM[col-rst]}\"; return 1" INT
|
||||
trap "print \"${ZINIT[col-pname]}ABORTING, the ice not ran${ZINIT[col-rst]}\"; return 1" INT
|
||||
local count=5 tpe="$1" ice
|
||||
ice="${ZPLG_ICE[$tpe]}"
|
||||
[[ $tpe = "atpull" && $ice = "%atclone" ]] && ice="${ZPLG_ICE[atclone]}"
|
||||
ice="${ZINIT_ICE[$tpe]}"
|
||||
[[ $tpe = "atpull" && $ice = "%atclone" ]] && ice="${ZINIT_ICE[atclone]}"
|
||||
ice="$tpe:$ice"
|
||||
print -nr "${ZPLGM[col-pname]}Running ${ZPLGM[col-bold]}${ZPLGM[col-uname]}$ice${ZPLGM[col-rst]}${ZPLGM[col-pname]} ice in...${ZPLGM[col-rst]} "
|
||||
print -nr "${ZINIT[col-pname]}Running ${ZINIT[col-bold]}${ZINIT[col-uname]}$ice${ZINIT[col-rst]}${ZINIT[col-pname]} ice in...${ZINIT[col-rst]} "
|
||||
while (( -- count + 1 )) {
|
||||
print -nr -- "${ZPLGM[col-bold]}${ZPLGM[col-error]}"$(( count + 1 ))..."${ZPLGM[col-rst]}"
|
||||
print -nr -- "${ZINIT[col-bold]}${ZINIT[col-error]}"$(( count + 1 ))..."${ZINIT[col-rst]}"
|
||||
sleep 1
|
||||
}
|
||||
print -r -- "${ZPLGM[col-bold]}${ZPLGM[col-error]}0 <running now>...${ZPLGM[col-rst]}"
|
||||
print -r -- "${ZINIT[col-bold]}${ZINIT[col-error]}0 <running now>...${ZINIT[col-rst]}"
|
||||
return 0
|
||||
}
|
||||
# }}}
|
||||
# >>>
|
||||
|
||||
# vim:ft=zsh:sw=4:sts=4:et
|
||||
# vim:ft=zsh:sw=4:sts=4:et:foldmarker=<<<,>>>
|
||||
|
|
@ -847,8 +847,8 @@ custom_try_source_file(char *file)
|
|||
/* If there is no zwc file, or if it is less recent than script file */
|
||||
if ( ( !rn && ( rc || ( stc.st_mtime < stn.st_mtime ) ) ) &&
|
||||
( access( file_dup, W_OK ) == 0 || 0 == strcmp(
|
||||
getsparam( "ZPLG_MOD_DEBUG" ) ?
|
||||
getsparam( "ZPLG_MOD_DEBUG" ) : "0",
|
||||
getsparam( "ZINIT_MOD_DEBUG" ) ?
|
||||
getsparam( "ZINIT_MOD_DEBUG" ) : "0",
|
||||
"1" ) )
|
||||
) {
|
||||
char *args[] = { file, NULL };
|
||||
|
|
@ -866,8 +866,8 @@ custom_try_source_file(char *file)
|
|||
bin_zcompile("ZpluginModule_", args, &ops, 0);
|
||||
} else {
|
||||
if ( 0 == strcmp(
|
||||
getsparam( "ZPLG_MOD_DEBUG" ) ?
|
||||
getsparam( "ZPLG_MOD_DEBUG" ) : "0",
|
||||
getsparam( "ZINIT_MOD_DEBUG" ) ?
|
||||
getsparam( "ZINIT_MOD_DEBUG" ) : "0",
|
||||
"1" )
|
||||
) {
|
||||
zwarnnam( "ZpluginModule",
|
||||
|
|
@ -1399,7 +1399,7 @@ void zpmod_usage() {
|
|||
"[33mCommand <report-append>:[0m\n"
|
||||
"\n"
|
||||
"Used by Zplugin internally to speed up loading plugins with tracking (reporting).\n"
|
||||
"It extends the given field {plugin-ID} in $ZPLG_REPORTS hash, with the given string\n"
|
||||
"It extends the given field {plugin-ID} in $ZINIT_REPORTS hash, with the given string\n"
|
||||
"{new-report-body}.\n"
|
||||
"\n"
|
||||
"[33mCommand <source-study>:[0m\n"
|
||||
|
|
@ -1425,14 +1425,14 @@ zp_append_report( const char *nam, const char *target, int target_len, const cha
|
|||
char *target_string = NULL;
|
||||
int target_string_len = 0, new_extended_len = 0;
|
||||
|
||||
/* Get ZPLG_REPORTS associative array */
|
||||
pm = ( Param ) paramtab->getnode( paramtab, "ZPLG_REPORTS" );
|
||||
/* Get ZINIT_REPORTS associative array */
|
||||
pm = ( Param ) paramtab->getnode( paramtab, "ZINIT_REPORTS" );
|
||||
if ( !pm ) {
|
||||
zwarnnam( nam, "%d: Parameter $ZPLG_REPORTS isn't declared. Zplugin is not loaded? I.e. not sourced.", __LINE__ );
|
||||
zwarnnam( nam, "%d: Parameter $ZINIT_REPORTS isn't declared. Zplugin is not loaded? I.e. not sourced.", __LINE__ );
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Get ZPLG_REPORTS[{target}] hashed Param */
|
||||
/* Get ZINIT_REPORTS[{target}] hashed Param */
|
||||
ht = pm->u.hash;
|
||||
hn = gethashnode2( ht, target );
|
||||
val_pm = ( Param ) hn;
|
||||
|
|
|
|||
2403
zplugin.zsh
2403
zplugin.zsh
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue