mirror of
https://github.com/zdharma-continuum/zinit.git
synced 2026-09-10 07:36:38 -04:00
doc: improve zsd gen, pdf output, and gh workflow (#220)
- Fix to re-enable users to generate zshelldoc documentation without docker. - Update most asciidoctor blocks in Zinit source code to fix issue where they would take up a line above the next function name - Remove unnecessary steps from the documentation Github action workflow - Misc. Makefile changes in clean and doc targets logic Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
This commit is contained in:
parent
af4dcd5950
commit
d0e7f9d204
33
.github/workflows/documentation.yaml
vendored
Normal file
33
.github/workflows/documentation.yaml
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
name: Documentation
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
||||
zshelldoc:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: check out repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: generate zsd
|
||||
run: |
|
||||
make doc-container
|
||||
sudo chown -R "$(id -u):$(id -g)" .
|
||||
|
||||
- name: check for out-of-date documentation
|
||||
run: |
|
||||
if git --no-pager diff --exit-code; then
|
||||
echo "zshelldocs are up to date"
|
||||
else
|
||||
echo "zshelldocs in the repo are not up to date"
|
||||
exit 1
|
||||
fi
|
||||
42
Makefile
42
Makefile
|
|
@ -1,5 +1,7 @@
|
|||
SHELL=zsh
|
||||
.EXPORT_ALL_VARIABLES:
|
||||
# SHELL=zsh
|
||||
SRC := zinit.zsh zinit-side.zsh zinit-install.zsh zinit-autoload.zsh
|
||||
DOC_SRC := $(foreach wrd,$(SRC),../$(wrd))
|
||||
|
||||
cur-dir := $(shell pwd)
|
||||
|
||||
|
|
@ -11,42 +13,10 @@ all: $(wildcard *.zsh)
|
|||
doc-container: zinit.zsh zinit-side.zsh zinit-install.zsh zinit-autoload.zsh
|
||||
./scripts/docker-run.sh --docs --debug
|
||||
|
||||
# doc:
|
||||
# rm -rf doc/zsdoc/{data,*.adoc}
|
||||
# cd doc;
|
||||
# zsd --cignore \
|
||||
# --scomm \
|
||||
# --verbose \
|
||||
# '(\#*FUNCTION:*{{{*|\#[[:space:]]#}}}*)' \
|
||||
# ../zinit.zsh ../zinit-side.zsh ../zinit-install.zsh ../zinit-autoload.zsh
|
||||
# EXECUTABLES = zsd
|
||||
# doc: clean
|
||||
# $(foreach exec,$(EXECUTABLES),\
|
||||
# $(if $(shell PATH=$(PATH) which $(exec)),exec,$(error "No $(exec) in PATH")))
|
||||
# zsd --cignore '(\#*FUNCTION:*{{{*|\#[[:space:]]#}}}*)' \
|
||||
# --scomm \
|
||||
# --verbose \
|
||||
# zinit.zsh zinit-side.zsh zinit-install.zsh zinit-autoload.zsh
|
||||
|
||||
# rm -rf doc/zsdoc/data doc/zsdoc/*.adoc
|
||||
# # cd is required since zsd outputs to PWD/zsdoc/
|
||||
# cd doc; \
|
||||
# zsh -ils -c -- "zsd -v --scomm --cignore '(\#*FUNCTION:*{{{*|\#[[:space:]]#}}}*)' ../zinit.zsh ../zinit-side.zsh ../zinit-install.zsh ../zinit-autoload.zsh"
|
||||
|
||||
# EXECUTABLES = zsd
|
||||
# doc: clean
|
||||
# $(foreach exec,$(EXECUTABLES),\
|
||||
# $(if $(shell PATH=$(PATH) which $(exec)),exec,$(error "No $(exec) in PATH")))
|
||||
# zsd --cignore '(\#*FUNCTION:*{{{*|\#[[:space:]]#}}}*)' \
|
||||
# --scomm \
|
||||
# --verbose \
|
||||
|
||||
foo := zinit.zsh zinit-side.zsh zinit-install.zsh zinit-autoload.zsh
|
||||
bar := $(foreach wrd,$(foo),../$(wrd))
|
||||
doc:
|
||||
cd doc; export TERM='xterm-256'; export LC_ALL='en_US.UTF-8'; $(SHELL) -c -- "zsd --scomm --cignore '(\#*FUNCTION:*{{{*|\#[[:space:]]#}}}*)' $(bar)"
|
||||
doc: clean
|
||||
cd doc; zsh -d -f -i -c "zsd -v --scomm --cignore '(\#*FUNCTION:*{{{*|\#[[:space:]]#}}}*)' $(DOC_SRC)"
|
||||
|
||||
clean:
|
||||
rm -rf *.zwc doc/zsdoc/data
|
||||
rm -rf doc/zsdoc/data doc/zsdoc/*.adoc
|
||||
|
||||
.PHONY: all test clean doc doc-container
|
||||
|
|
|
|||
|
|
@ -192,7 +192,6 @@ Called by:
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: .zinit-extract [[[
|
||||
____
|
||||
|
||||
|
|
@ -214,7 +213,6 @@ Called by:
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: .zinit-forget-completion [[[
|
||||
Implements alternation of Zsh state so that already initialized
|
||||
completion stops being visible to Zsh.
|
||||
|
|
@ -238,7 +236,6 @@ Called by:
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: .zinit-get-cygwin-package [[[
|
||||
____
|
||||
|
||||
|
|
@ -258,7 +255,6 @@ Called by:
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: .zinit-get-latest-gh-r-url-part [[[
|
||||
Gets version string of latest release of given Github
|
||||
package. Connects to Github releases page.
|
||||
|
|
@ -441,7 +437,6 @@ Called by:
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: .zinit-setup-plugin-dir [[[
|
||||
Clones given plugin into PLUGIN_DIR. Supports multiple
|
||||
sites (respecting `from' and `proto' ice modifiers).
|
||||
|
|
@ -473,7 +468,6 @@ Called by:
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: .zinit-update-snippet [[[
|
||||
____
|
||||
|
||||
|
|
@ -495,7 +489,6 @@ zicp
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: zicp [[[
|
||||
____
|
||||
|
||||
|
|
@ -514,7 +507,6 @@ ziextract
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: ziextract [[[
|
||||
If the file is an archive, it is extracted by this function.
|
||||
Next stage is scanning of files with the common utility `file',
|
||||
|
|
@ -554,7 +546,6 @@ zpextract
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: zpextract [[[
|
||||
____
|
||||
|
||||
|
|
@ -571,7 +562,6 @@ Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: ∞zinit-atclone-hook [[[
|
||||
____
|
||||
|
||||
|
|
@ -590,7 +580,6 @@ Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: ∞zinit-atpull-e-hook [[[
|
||||
____
|
||||
|
||||
|
|
@ -608,7 +597,6 @@ Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: ∞zinit-atpull-hook [[[
|
||||
____
|
||||
|
||||
|
|
@ -643,7 +631,6 @@ Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: ∞zinit-cp-hook [[[
|
||||
____
|
||||
|
||||
|
|
@ -661,7 +648,6 @@ Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: ∞zinit-extract-hook [[[
|
||||
____
|
||||
|
||||
|
|
@ -677,7 +663,6 @@ Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: ∞zinit-make-e-hook [[[
|
||||
____
|
||||
|
||||
|
|
@ -694,7 +679,6 @@ Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: ∞zinit-make-ee-hook [[[
|
||||
____
|
||||
|
||||
|
|
@ -711,7 +695,6 @@ Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: ∞zinit-make-hook [[[
|
||||
____
|
||||
|
||||
|
|
@ -728,7 +711,6 @@ Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: ∞zinit-mv-hook [[[
|
||||
____
|
||||
|
||||
|
|
@ -747,7 +729,6 @@ Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: ∞zinit-ps-on-update-hook [[[
|
||||
____
|
||||
|
||||
|
|
@ -765,7 +746,6 @@ Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: ∞zinit-reset-opt-hook [[[
|
||||
____
|
||||
|
||||
|
|
@ -795,7 +775,7 @@ ____
|
|||
`#compdef <names ...>'
|
||||
____
|
||||
|
||||
Has 573 line(s). Doesn't call other functions.
|
||||
Has 549 line(s). Doesn't call other functions.
|
||||
|
||||
Uses feature(s): _autoload_, _bindkey_, _compdef_, _compdump_, _eval_, _read_, _setopt_, _unfunction_, _zle_, _zstyle_
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,6 @@ Called by:
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: .zinit-compute-ice [[[
|
||||
Computes ICE array (default, it can be specified via $3) from a) input
|
||||
ICE, b) static ice, c) saved ice, taking priorities into account. Also
|
||||
|
|
@ -122,7 +121,6 @@ Called by:
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
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.
|
||||
|
|
@ -240,7 +238,6 @@ Called by:
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: .zinit-store-ices [[[
|
||||
Saves ice mods in given hash onto disk.
|
||||
|
||||
|
|
|
|||
|
|
@ -108,7 +108,6 @@ _Exports (environment):_ PMSPEC [big]*//* ZPFX [big]*//* ZSH_CACHE_DIR
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: +zinit-deploy-message. [[[
|
||||
Deploys a sub-prompt message to be displayed OR a `zle
|
||||
.reset-prompt' call to be invoked
|
||||
|
|
@ -129,7 +128,6 @@ Called by:
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: +zinit-message. [[[
|
||||
____
|
||||
|
||||
|
|
@ -180,7 +178,6 @@ Called by:
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: +zinit-prehelp-usage-message. [[[
|
||||
____
|
||||
|
||||
|
|
@ -199,7 +196,6 @@ Called by:
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: -zinit_scheduler_add_sh. [[[
|
||||
Copies task into ZINIT_RUN array, called when a task timeouts.
|
||||
A small function ran from pattern in /-substitution as a math
|
||||
|
|
@ -482,7 +478,6 @@ Called by:
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: .zinit-formatter-bar. [[[
|
||||
____
|
||||
|
||||
|
|
@ -512,7 +507,6 @@ Called by:
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: .zinit-formatter-pid. [[[
|
||||
____
|
||||
|
||||
|
|
@ -530,7 +524,6 @@ Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: .zinit-formatter-th-bar. [[[
|
||||
____
|
||||
|
||||
|
|
@ -545,7 +538,6 @@ Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: .zinit-formatter-url. [[[
|
||||
____
|
||||
|
||||
|
|
@ -705,7 +697,6 @@ Called by:
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: .zinit-load-snippet. [[[
|
||||
Implements the exposed-to-user action of loading a snippet.
|
||||
|
||||
|
|
@ -733,7 +724,6 @@ Called by:
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: +zinit-message-formatter [[[
|
||||
____
|
||||
|
||||
|
|
@ -770,7 +760,6 @@ Called by:
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: +zinit-parse-opts. [[[
|
||||
____
|
||||
|
||||
|
|
@ -830,7 +819,6 @@ Called by:
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: .zinit-run. [[[
|
||||
Run code inside plugin's folder
|
||||
It uses the `correct' parameter from upper's scope zinit().
|
||||
|
|
@ -905,7 +893,6 @@ Called by:
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: .zinit-setup-params. [[[
|
||||
____
|
||||
|
||||
|
|
@ -1193,7 +1180,6 @@ Called by:
|
|||
|
||||
____
|
||||
|
||||
]]]
|
||||
FUNCTION: @zinit-scheduler. [[[
|
||||
Searches for timeout tasks, executes them. There's an array of tasks
|
||||
waiting for execution, this scheduler manages them, detects which ones
|
||||
|
|
@ -1551,7 +1537,7 @@ ____
|
|||
`#compdef <names ...>'
|
||||
____
|
||||
|
||||
Has 573 line(s). Doesn't call other functions.
|
||||
Has 549 line(s). Doesn't call other functions.
|
||||
|
||||
Uses feature(s): _autoload_, _bindkey_, _compdef_, _compdump_, _eval_, _read_, _setopt_, _unfunction_, _zle_, _zstyle_
|
||||
|
||||
|
|
|
|||
|
|
@ -18,9 +18,7 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
|
|||
"{nl}{u-warn}To do so with zinit, please refer to:{rst}" \
|
||||
"https://github.com/zdharma-continuum/zinit/wiki/%F0%9F%A7%8A-Recommended-ices#jq"
|
||||
return 1
|
||||
}
|
||||
# ]]]
|
||||
|
||||
} # ]]]
|
||||
# FUNCTION: .zinit-json-get-value [[[
|
||||
# Wrapper around jq that return the value of a property
|
||||
# $1: JSON structure
|
||||
|
|
@ -30,9 +28,7 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
|
|||
|
||||
local jsonstr=$1 jqpath=$2
|
||||
jq -er ".${jqpath}" <<< "$jsonstr"
|
||||
}
|
||||
# ]]]
|
||||
|
||||
} # ]]]
|
||||
# FUNCTION: .zinit-json-to-array [[[
|
||||
# Wrapper around jq that sets key/values of an associative array, replicating
|
||||
# the structure of a given JSON object
|
||||
|
|
@ -58,9 +54,7 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
|
|||
map($varname + "[\(.key)]=\(.value | @sh);")[]' \
|
||||
<<< "$jsonstr")
|
||||
eval "$evalstr"
|
||||
}
|
||||
# ]]]
|
||||
|
||||
} # ]]]
|
||||
# FUNCTION: .zinit-get-package [[[
|
||||
.zinit-get-package() {
|
||||
.zinit-jq-check || return 1
|
||||
|
|
@ -287,8 +281,7 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
|
|||
}
|
||||
|
||||
return $?
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# FUNCTION: .zinit-setup-plugin-dir [[[
|
||||
# Clones given plugin into PLUGIN_DIR. Supports multiple
|
||||
# sites (respecting `from' and `proto' ice modifiers).
|
||||
|
|
@ -782,8 +775,7 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
|
|||
command svn checkout --non-interactive -q "$url" "$directory"
|
||||
fi
|
||||
return $?
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# FUNCTION: .zinit-forget-completion [[[
|
||||
# Implements alternation of Zsh state so that already initialized
|
||||
# completion stops being visible to Zsh.
|
||||
|
|
@ -1336,8 +1328,7 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
|
|||
(( !OPTS[opt_-p,--parallel] )) && rehash
|
||||
|
||||
return $retval
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# FUNCTION: .zinit-update-snippet [[[
|
||||
.zinit-update-snippet() {
|
||||
emulate -LR zsh
|
||||
|
|
@ -1430,8 +1421,7 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
|
|||
.zinit-download-snippet "$save_url" "$url" "$id_as" "$local_dir" "$dirname" "$filename" "-u"
|
||||
|
||||
return $?
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# FUNCTION: .zinit-get-latest-gh-r-url-part [[[
|
||||
# Gets version string of latest release of given Github
|
||||
# package. Connects to Github releases page.
|
||||
|
|
@ -1557,8 +1547,7 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
|
|||
reply+=( $list[1] )
|
||||
}
|
||||
[[ -n $reply ]] # testable
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# FUNCTION: ziextract [[[
|
||||
# If the file is an archive, it is extracted by this function.
|
||||
# Next stage is scanning of files with the common utility `file',
|
||||
|
|
@ -1875,8 +1864,7 @@ ziextract() {
|
|||
REPLY="${execs[1]}"
|
||||
}
|
||||
return 0
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# FUNCTION: .zinit-extract [[[
|
||||
.zinit-extract() {
|
||||
emulate -LR zsh
|
||||
|
|
@ -1909,8 +1897,7 @@ ziextract() {
|
|||
${${${#files}:#1}:+--nobkp}
|
||||
}
|
||||
)
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# FUNCTION: zpextract [[[
|
||||
zpextract() { ziextract "$@"; }
|
||||
# ]]]
|
||||
|
|
@ -1925,8 +1912,7 @@ zpextract() { ziextract "$@"; }
|
|||
|
||||
eval "$cmd"
|
||||
return "$?"
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# FUNCTION: .zinit-get-cygwin-package [[[
|
||||
.zinit-get-cygwin-package() {
|
||||
emulate -LR zsh
|
||||
|
|
@ -2011,8 +1997,7 @@ zpextract() { ziextract "$@"; }
|
|||
break
|
||||
}
|
||||
REPLY=$outfile
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# FUNCTION: zicp [[[
|
||||
zicp() {
|
||||
emulate -LR zsh
|
||||
|
|
@ -2051,8 +2036,7 @@ zimv() {
|
|||
local dir
|
||||
if [[ $1 = (-d|--dir) ]] { dir=$2; shift 2; }
|
||||
zicp --mv ${dir:+--dir} $dir "$@"
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# FUNCTION: ∞zinit-reset-opt-hook [[[
|
||||
∞zinit-reset-hook() {
|
||||
# File
|
||||
|
|
@ -2137,8 +2121,7 @@ zimv() {
|
|||
# If there's no -r/--reset, pretend that it already has been served.
|
||||
ZINIT[-r/--reset-opt-hook-has-been-run]=1
|
||||
}
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# FUNCTION: ∞zinit-make-ee-hook [[[
|
||||
∞zinit-make-ee-hook() {
|
||||
[[ "$1" = plugin ]] && \
|
||||
|
|
@ -2154,8 +2137,7 @@ zimv() {
|
|||
# Git-plugin make'' at download
|
||||
.zinit-countdown make && \
|
||||
command make -C "$dir" ${(@s; ;)${make#\!\!}}
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# FUNCTION: ∞zinit-make-e-hook [[[
|
||||
∞zinit-make-e-hook() {
|
||||
[[ "$1" = plugin ]] && \
|
||||
|
|
@ -2171,8 +2153,7 @@ zimv() {
|
|||
# Git-plugin make'' at download
|
||||
.zinit-countdown make && \
|
||||
command make -C "$dir" ${(@s; ;)${make#\!}}
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# FUNCTION: ∞zinit-make-hook [[[
|
||||
∞zinit-make-hook() {
|
||||
[[ "$1" = plugin ]] && \
|
||||
|
|
@ -2188,8 +2169,7 @@ zimv() {
|
|||
# Git-plugin make'' at download
|
||||
.zinit-countdown make &&
|
||||
command make -C "$dir" ${(@s; ;)make}
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# FUNCTION: ∞zinit-atclone-hook [[[
|
||||
∞zinit-atclone-hook() {
|
||||
[[ "$1" = plugin ]] && \
|
||||
|
|
@ -2218,8 +2198,7 @@ zimv() {
|
|||
}
|
||||
|
||||
return "$rc"
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# FUNCTION: ∞zinit-extract-hook [[[
|
||||
∞zinit-extract-hook() {
|
||||
[[ "$1" = plugin ]] && \
|
||||
|
|
@ -2232,8 +2211,7 @@ zimv() {
|
|||
(( ${+ICE[extract]} )) || return 0
|
||||
|
||||
.zinit-extract plugin "$extract" "$dir"
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# FUNCTION: ∞zinit-mv-hook [[[
|
||||
∞zinit-mv-hook() {
|
||||
[[ -z $ICE[mv] ]] && return 0
|
||||
|
|
@ -2271,8 +2249,7 @@ zimv() {
|
|||
command mv "${mv_args[@]}" "${afr[1]}".zwc "$to".zwc 2>/dev/null
|
||||
return $retval
|
||||
)
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# FUNCTION: ∞zinit-cp-hook [[[
|
||||
∞zinit-cp-hook() {
|
||||
[[ -z $ICE[cp] ]] && return
|
||||
|
|
@ -2327,8 +2304,7 @@ zimv() {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# FUNCTION: ∞zinit-atpull-e-hook [[[
|
||||
∞zinit-atpull-e-hook() {
|
||||
(( ${+ICE[atpull]} )) || return 0
|
||||
|
|
@ -2354,8 +2330,7 @@ zimv() {
|
|||
}
|
||||
|
||||
return "$rc"
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# FUNCTION: ∞zinit-atpull-hook [[[
|
||||
∞zinit-atpull-hook() {
|
||||
(( ${+ICE[atpull]} )) || return 0
|
||||
|
|
@ -2381,8 +2356,7 @@ zimv() {
|
|||
}
|
||||
|
||||
return "$rc"
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# FUNCTION: ∞zinit-ps-on-update-hook [[[
|
||||
∞zinit-ps-on-update-hook() {
|
||||
[[ -z $ICE[ps-on-update] ]] && return 0
|
||||
|
|
@ -2403,6 +2377,5 @@ zimv() {
|
|||
eval "$ICE[ps-on-update]" &> /dev/null
|
||||
)
|
||||
}
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# vim:ft=zsh:sw=4:sts=4:et:foldmarker=[[[,]]]:foldmethod=marker
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@
|
|||
|
||||
.zinit-any-to-pid "$1" "$2"
|
||||
.zinit-get-object-path plugin "$REPLY"
|
||||
integer ret=$?
|
||||
integer ret=$?
|
||||
local dname="$REPLY"
|
||||
(( ret )) && { reply=( "$dname" "" ); return 1; }
|
||||
|
||||
|
|
@ -152,8 +152,7 @@
|
|||
fileB_there=( "$local_dirB/$dirnameB"/*~*.(zwc|md|js|html)(.-DOnN[1]) )
|
||||
|
||||
reply=( "$local_dirA/$dirnameA" "$svn_dirA" "$local_dirB/$dirnameB" "${fileB_there[1]##$local_dirB/$dirnameB/#}" )
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# FUNCTION: .zinit-compute-ice [[[
|
||||
# Computes ICE array (default, it can be specified via $3) from a) input
|
||||
# ICE, b) static ice, c) saved ice, taking priorities into account. Also
|
||||
|
|
@ -317,8 +316,7 @@
|
|||
: ${(P)___var_name4::=$___is_snippet}
|
||||
|
||||
return 0
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# FUNCTION: .zinit-store-ices [[[
|
||||
# Saves ice mods in given hash onto disk.
|
||||
#
|
||||
|
|
@ -377,8 +375,7 @@
|
|||
for ___key in url mode; do
|
||||
[[ -n "${(P)___key}" ]] && builtin print -r -- "${(P)___key}" >! "$___pfx"/"$___key"
|
||||
done
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# 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.
|
||||
|
|
@ -398,7 +395,6 @@
|
|||
}
|
||||
+zinit-message -r -- "{b}{error}0 <running now>{rst}{…}"
|
||||
return 0
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
|
||||
# vim:ft=zsh:sw=4:sts=4:et:foldmarker=[[[,]]]:foldmethod=marker
|
||||
|
|
|
|||
77
zinit.zsh
77
zinit.zsh
|
|
@ -1285,8 +1285,8 @@ builtin setopt noaliases
|
|||
+zinit-message "{error}ERROR #1"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
|
||||
# FUNCTION: .zinit-load-snippet. [[[
|
||||
# Implements the exposed-to-user action of loading a snippet.
|
||||
#
|
||||
|
|
@ -1527,6 +1527,7 @@ builtin setopt noaliases
|
|||
.zinit-set-m-func unset
|
||||
return retval
|
||||
} # ]]]
|
||||
|
||||
# FUNCTION: .zinit-load. [[[
|
||||
# Implements the exposed-to-user action of loading a plugin.
|
||||
#
|
||||
|
|
@ -1634,6 +1635,7 @@ builtin setopt noaliases
|
|||
ZINIT[AT_TIME_${ZINIT[TIME_INDEX]}_${___id_as//\//---}]=$EPOCHREALTIME
|
||||
return ___retval
|
||||
} # ]]]
|
||||
|
||||
# FUNCTION: .zinit-load-plugin. [[[
|
||||
# Lower-level function for loading a plugin.
|
||||
#
|
||||
|
|
@ -1787,6 +1789,7 @@ builtin setopt noaliases
|
|||
|
||||
return ___retval
|
||||
} # ]]]
|
||||
|
||||
# FUNCTION: .zinit-compdef-replay. [[[
|
||||
# Runs gathered compdef calls. This allows to run `compinit'
|
||||
# after loading plugins.
|
||||
|
|
@ -1814,6 +1817,7 @@ builtin setopt noaliases
|
|||
|
||||
return 0
|
||||
} # ]]]
|
||||
|
||||
# FUNCTION: .zinit-compdef-clear. [[[
|
||||
# Implements user-exposed functionality to clear gathered compdefs.
|
||||
.zinit-compdef-clear() {
|
||||
|
|
@ -1821,6 +1825,7 @@ builtin setopt noaliases
|
|||
ZINIT_COMPDEF_REPLAY=( )
|
||||
[[ $quiet = -q ]] || +zinit-message "Compdef-replay cleared (it had {num}${count}{rst} entries)."
|
||||
} # ]]]
|
||||
|
||||
# FUNCTION: .zinit-add-report. [[[
|
||||
# Adds a report line for given plugin.
|
||||
#
|
||||
|
|
@ -1832,6 +1837,7 @@ builtin setopt noaliases
|
|||
[[ ${ZINIT[DTRACE]} = 1 ]] && { (( ${+builtins[zpmod]} )) && zpmod report-append _dtrace/_dtrace "$2"$'\n' || ZINIT_REPORTS[_dtrace/_dtrace]+="$2"$'\n'; }
|
||||
return 0
|
||||
} # ]]]
|
||||
|
||||
# FUNCTION: .zinit-add-fpath. [[[
|
||||
.zinit-add-fpath() {
|
||||
[[ $1 = (-f|--front) ]] && { shift; integer front=1; }
|
||||
|
|
@ -1844,8 +1850,8 @@ builtin setopt noaliases
|
|||
${${${(M)user:#%}:+$plugin}:-${ZINIT[PLUGINS_DIR]}/${id_as//\//---}}${add_dir:+/$add_dir}
|
||||
)
|
||||
}
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
|
||||
# FUNCTION: .zinit-run. [[[
|
||||
# Run code inside plugin's folder
|
||||
# It uses the `correct' parameter from upper's scope zinit().
|
||||
|
|
@ -1874,8 +1880,8 @@ builtin setopt noaliases
|
|||
else
|
||||
+zinit-message "{u-warn}Error{b-warn}:{rst} no such plugin or snippet."
|
||||
fi
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
|
||||
# FUNCTION: +zinit-deploy-message. [[[
|
||||
# Deploys a sub-prompt message to be displayed OR a `zle
|
||||
# .reset-prompt' call to be invoked
|
||||
|
|
@ -1895,8 +1901,8 @@ builtin setopt noaliases
|
|||
exec {THEFD} < <(LANG=C sleep $(( 0.01 + ${${${(M)1#@sleep:}:+${1#@sleep:}}:-0} )); builtin print -r -- ${1:#(@msg|@sleep:*)} "${@[2,-1]}"; )
|
||||
command true # workaround a Zsh bug, see: https://www.zsh.org/mla/workers/2018/msg00966.html
|
||||
builtin zle -F "$THEFD" +zinit-deploy-message
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
|
||||
# FUNCTION: .zinit-formatter-pid. [[[
|
||||
.zinit-formatter-pid() {
|
||||
builtin emulate -L zsh -o extendedglob
|
||||
|
|
@ -1918,13 +1924,13 @@ builtin setopt noaliases
|
|||
|
||||
# Re-add whitespace
|
||||
REPLY=$pbz$REPLY$kbz
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
|
||||
# FUNCTION: .zinit-formatter-bar. [[[
|
||||
.zinit-formatter-bar() {
|
||||
.zinit-formatter-bar-util ─ bar
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
|
||||
# FUNCTION: .zinit-formatter-th-bar. [[[
|
||||
.zinit-formatter-th-bar() {
|
||||
.zinit-formatter-bar-util ━ th-bar
|
||||
|
|
@ -1938,8 +1944,8 @@ builtin setopt noaliases
|
|||
fi
|
||||
|
||||
REPLY=$ZINIT[col-$2]${(pl:COLUMNS-1::$ch:):-}$ZINIT[col-rst]
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
|
||||
# FUNCTION: .zinit-formatter-url. [[[
|
||||
.zinit-formatter-url() {
|
||||
builtin emulate -LR zsh -o extendedglob
|
||||
|
|
@ -1966,8 +1972,8 @@ builtin setopt noaliases
|
|||
# …revert to the basic if not…
|
||||
REPLY=$ZINIT[col-url]$1$ZINIT[col-rst]
|
||||
}
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
|
||||
# FUNCTION: +zinit-message-formatter [[[
|
||||
.zinit-main-message-formatter() {
|
||||
if [[ -z $1 && -z $2 && -z $3 ]]; then
|
||||
|
|
@ -2001,8 +2007,8 @@ builtin setopt noaliases
|
|||
REPLY=${REPLY//$nl/$vertical$carriager}
|
||||
|
||||
# REPLY+="x(${3}…)"
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
|
||||
# FUNCTION: +zinit-message. [[[
|
||||
+zinit-message() {
|
||||
builtin emulate -LR zsh -o extendedglob
|
||||
|
|
@ -2033,8 +2039,8 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
|||
if [[ -n ${opt:#*n*} || -z $opt ]]; then
|
||||
print -n $'\015'
|
||||
fi
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
|
||||
# FUNCTION: +zinit-prehelp-usage-message. [[[
|
||||
+zinit-prehelp-usage-message() {
|
||||
builtin emulate -LR zsh -o extendedglob
|
||||
|
|
@ -2079,14 +2085,13 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
|||
"See \`{cmd}help$bcol\` for a more detailed usage information and" \
|
||||
"the list of the {cmd}subcommands$bcol.{rst}"
|
||||
}
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
|
||||
# FUNCTION: +zinit-parse-opts. [[[
|
||||
.zinit-parse-opts() {
|
||||
builtin emulate -LR zsh -o extendedglob
|
||||
reply=( "${(@)${@[2,-1]//([ $'\t']##|(#s))(#b)(${(~j.|.)${(@s.|.)___opt_map[$1]}})(#B)([ $'\t']##|(#e))/${OPTS[${___opt_map[${match[1]}]%%:*}]::=1}ß←↓→}:#1ß←↓→}" )
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
|
||||
#
|
||||
# Ice support.
|
||||
|
|
@ -2111,6 +2116,7 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
|||
[[ -n ${ZINIT_ICES[pick]} ]] && ZINIT_ICES[pick]="${ZINIT_ICES[pick]//\$ZPFX/${ZPFX%/}}"
|
||||
return retval
|
||||
} # ]]]
|
||||
|
||||
# FUNCTION: .zinit-pack-ice. [[[
|
||||
# Remembers all ice-mods, assigns them to concrete plugin. Ice spec
|
||||
# is in general forgotten for second-next command (that's why it's
|
||||
|
|
@ -2122,6 +2128,7 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
|||
ZINIT_SICE[$1${1:+${2:+/}}$2]="${ZINIT_SICE[$1${1:+${2:+/}}$2]# }"
|
||||
return 0
|
||||
} # ]]]
|
||||
|
||||
# FUNCTION: .zinit-load-ices. [[[
|
||||
.zinit-load-ices() {
|
||||
local id_as="$1" ___key ___path
|
||||
|
|
@ -2147,15 +2154,14 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
|||
[[ -n ${ICE[pick]} ]] && ICE[pick]="${ICE[pick]//\$ZPFX/${ZPFX%/}}"
|
||||
|
||||
return 0
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
|
||||
# FUNCTION: .zinit-setup-params. [[[
|
||||
.zinit-setup-params() {
|
||||
emulate -LR zsh -o extendedglob
|
||||
reply=( ${(@)${(@s.;.)ICE[param]}/(#m)*/${${MATCH%%(-\>|→|=\>)*}//((#s)[[:space:]]##|[[:space:]]##(#e))}${${(M)MATCH#*(-\>|→|=\>)}:+\=${${MATCH#*(-\>|→|=\>)}//((#s)[[:space:]]##|[[:space:]]##(#e))}}} )
|
||||
(( ${#reply} )) && return 0 || return 1
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
|
||||
#
|
||||
# Turbo.
|
||||
|
|
@ -2246,8 +2252,7 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
|||
elif [[ -n ${ICE[wait]}${ICE[load]}${ICE[unload]}${ICE[subscribe]} ]]; then
|
||||
ZINIT_TASKS+=( "${${ICE[wait]:+0}:-1}+0+1 $tpe ${ZINIT[WAIT_IDX]} ${mode:-_} ${(q)id} ${opt_plugin:+${(q)opt_uspl2}}" )
|
||||
fi
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# FUNCTION: -zinit_scheduler_add_sh. [[[
|
||||
# Copies task into ZINIT_RUN array, called when a task timeouts.
|
||||
# A small function ran from pattern in /-substitution as a math
|
||||
|
|
@ -2260,8 +2265,7 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
|||
else
|
||||
return idx
|
||||
fi
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
# FUNCTION: @zinit-scheduler. [[[
|
||||
# Searches for timeout tasks, executes them. There's an array of tasks
|
||||
# waiting for execution, this scheduler manages them, detects which ones
|
||||
|
|
@ -2379,8 +2383,7 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
|||
ZINIT_RUN[1-correct,___idx-correct]=()
|
||||
|
||||
[[ ${ZINIT[lro-data]##*:} = on ]] && return 0 || return ___ret
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
|
||||
#
|
||||
# Exposed functions.
|
||||
|
|
@ -3022,8 +3025,7 @@ zicompdef() { ZINIT_COMPDEF_REPLAY+=( "${(j: :)${(q)@}}" ); }
|
|||
:zinit-tmp-subst-autoload -Uz \
|
||||
${(s: :)${${(j: :)${@#\!}}//(#b)((*)(->|=>|→)(*)|(*))/${match[2]:+$match[2] -S $match[4]}${match[5]:+${match[5]} -S ${match[5]}}}} \
|
||||
${${${(@M)${@#\!}:#*(->|=>|→)*}}:+-C} ${${@#\!}:+-C}
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
|
||||
# Compatibility functions. [[[
|
||||
zplugin() { zinit "$@"; }
|
||||
|
|
@ -3100,8 +3102,7 @@ if [[ -e ${${ZINIT[BIN_DIR]}}/zmodules/Src/zdharma/zplugin.so ]] {
|
|||
command date '+%s' >! "${ZINIT[BIN_DIR]}/zmodules/COMPILED_AT"
|
||||
}
|
||||
}
|
||||
}
|
||||
# ]]]
|
||||
} # ]]]
|
||||
|
||||
# !atpull-pre.
|
||||
@zinit-register-hook "-r/--reset" hook:e-\!atpull-pre ∞zinit-reset-hook
|
||||
|
|
|
|||
Loading…
Reference in a new issue