Skip to content

Commit

Permalink
docs: generate
Browse files Browse the repository at this point in the history
Signed-off-by: GitHub Actions <[email protected]>
Signed-off-by: Vladislav Doster <[email protected]>
  • Loading branch information
actions-user authored and vladdoster committed Dec 18, 2023
1 parent 550d118 commit 44e4c7b
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 107 deletions.
57 changes: 2 additions & 55 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,55 +1,2 @@
.EXPORT_ALL_VARIABLES:

ZSH := $(shell command -v zsh 2> /dev/null)
SRC := zinit{'','-additional','-autoload','-install','-side'}.zsh
DOC_SRC := $(foreach wrd,$(SRC),../$(wrd))

.PHONY: all clean container doc doc/container tags tags/emacs tags/vim test zwc

clean:
@$(ZSH) -c "print -Pr '%BRemoving%b:'; print -C 3 -lPr tests/_output/*(.N) tests/_support/{default-ice,binary-symlink,tmp*}(N) *.zwc(N) doc/zsdoc/zinit*.zsh.adoc(N) doc/zsdoc/data/(N)"
@$(ZSH) -c "rm -rf tests/_output/*(.N) tests/_support/{default-ice,binary-symlink,tmp*}(N) *.zwc(N) doc/zsdoc/data/(N)"

container:
docker build --tag=ghcr.io/zdharma-continuum/zinit:latest --file=docker/Dockerfile .

doc: clean
cd doc; zsh -l -d -f -i -c "zsd -v --scomm --cignore '(\#*FUNCTION:[[:space:]][_\:\∞\.\+\@\-a-zA-Z0-9]*[\[]*|}[[:space:]]\#[[:space:]][\]]*)' $(DOC_SRC)"

doc/container: container
./scripts/docker-run.sh --docs --debug

# Run ctags to generate Emacs and Vim's format tag file.
tags: tags/emacs tags/vim

tags/emacs: ## Build Emacs-style ctags file
@if type ctags >/dev/null 2>&1; then \
if ctags --version | grep >/dev/null 2>&1 "Universal Ctags"; then \
ctags -e -R --options=share/zsh.ctags --languages=zsh \
--pattern-length-limit=250 --maxdepth=1; \
else \
ctags -e -R --languages=sh --langmap=sh:.zsh; \
fi; \
printf "Created the Emacs \`TAGS\` file.\\n"; \
else \
printf 'Error: Please install a Ctags (e.g.: either the Exuberant or Universal %b' \
'version) utility first.\n'; \
fi

tags/vim: ## Build the Vim-style ctags file
@if type ctags >/dev/null 2>&1; then \
if ctags --version | grep >/dev/null 2>&1 "Universal Ctags"; then \
ctags --languages=zsh --maxdepth=1 --options=share/zsh.ctags --pattern-length-limit=250 -R; \
else \
ctags -R --languages=sh --langmap=sh:.zsh; \
fi; \
printf "Created the Vim's style \`tags\` file.\\n"; \
else \
printf 'Error: Please install a ctags first.\n'; \
fi

test:
zunit run

zwc:
$(or $(ZSH),:) -fc 'for f in *.zsh; do zcompile -R -- $$f.zwc $$f || exit; done'
ERROR: Unknown subcommand: `all: touch whatever ` (it should be one of, e.g.: `load`, `snippet`, `update`, `delete`, …, e.g.: `zinit load username/reponame`) or a for-based command body (i.e.: e.g.: `zinit …ice-spec… for …(plugin or snippet) ID-1 ID-2 ⋯⋯…`). See `help` for a more detailed usage information and the list of the subcommands.

Expand Down
2 changes: 1 addition & 1 deletion doc/zsdoc/zinit-autoload.zsh.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ Called by:

==== .zinit-run-delete-hooks

Has 32 line(s). Calls functions:
Has 33 line(s). Calls functions:

.zinit-run-delete-hooks
`-- zinit.zsh/+zi-log
Expand Down
2 changes: 1 addition & 1 deletion doc/zsdoc/zinit-install.zsh.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ ____
____

Has 40 line(s). Calls functions:
Has 45 line(s). Calls functions:

∞zinit-configure-base-hook
|-- zinit.zsh/+zi-log
Expand Down
37 changes: 18 additions & 19 deletions tests/_support/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,18 @@ if [[ ! -d ${TMP_ZUNIT} ]]; then
exit 1
fi

typeset -gx zi_dir="${TMP_ZUNIT}"
typeset -gxA ZINIT=()
typeset -gx zi_test_dir="${TMP_ZUNIT}"
typeset -gxAUH ZINIT
# DEBUG 'true'
ZINIT+=(
BIN_DIR ${zi_dir}/zinit.git
COMPLETIONS_DIR ${zi_dir}/completions SNIPPETS_DIR ${zi_dir}/snippets
HOME_DIR ${zi_dir} PLUGINS_DIR ${zi_dir}/plugins
ZCOMPDUMP_PATH ${zi_dir}/zcompdump ZPFX ${zi_dir}/polaris
POLARIS ${zi_dir}/polaris
BIN_DIR ${zi_test_dir}/zinit.git
COMPLETIONS_DIR ${zi_test_dir}/completions SNIPPETS_DIR ${zi_test_dir}/snippets
HOME_DIR ${zi_test_dir} PLUGINS_DIR ${zi_test_dir}/plugins
ZCOMPDUMP_PATH ${zi_test_dir}/zcompdump ZPFX ${zi_test_dir}/polaris
POLARIS ${zi_test_dir}/polaris
)
# typeset -gxH ZPFX="$ZINIT[POLARIS]"
typeset -gxH ZPFX=
ZPFX="$zi_test_dir"/polaris
# FORK 'vladdoster' REPO 'zinit-t'
# typeset -gxAUH ZINIT=(${(kv)CONFIG})

Expand Down Expand Up @@ -60,27 +61,25 @@ fi
(( $? != 0 )) && { error "Unable to copy ${GIT_REPO} to ${TMP_ZUNIT}" >&2; exit 1 }

hash -f
builtin hash -d zinit=$zi_dir
builtin hash -d zpfx=$zi_dir/polaris
source $zi_dir/zinit.git/zinit.zsh
builtin hash -d zinit=$zi_test_dir
builtin hash -d zpfx=$zi_test_dir/polaris
builtin hash -d plugins=$zi_test_dir/plugins
source $zi_test_dir/zinit.git/zinit.zsh
(( $? != 0 )) && { error "Unable to source zinit" >&2; exit 1 }
hash -f
builtin hash -d zinit=$zi_dir
builtin hash -d zpfx=$zi_dir/polaris

builtin hash -d zinit=$zi_test_dir
builtin hash -d zpfx=$zi_test_dir/polaris
builtin hash -d plugins=$zi_test_dir/plugins
# ]]]
# Install Annexes [[[
# +zi-log '{m} installing test dependencies'
{
zinit for \
depth'1' \
zinit for \
@zdharma-continuum/zinit-annex-linkman \
depth'1' \
@zdharma-continuum/zinit-annex-default-ice \
ver'feat/logging' \
@zdharma-continuum/zinit-annex-binary-symlink
} >/dev/null
+zi-log "{m} loaded $annex dependencies"
# ]]]
zinit zstatus

# vim:ft=zsh:sw=2:sts=2:et:foldmarker=[[[,]]]:foldmethod=marker
2 changes: 1 addition & 1 deletion tests/commands.zunit
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
assert $state equals 0
}
@test 'delete a program' {
run zinit as'program' cp'wd.sh->wd' mv'_wd.sh->_wd' pick'wd' for @'mfaerevaag/wd'
run zinit as'program' mv'wd.sh->wd' mv'_wd.sh->_wd' pick'wd' for @'mfaerevaag/wd'
run zinit delete --yes mfaerevaag/wd
assert $state equals 0
}
Expand Down
16 changes: 8 additions & 8 deletions tests/gh-r.zunit
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
$act --version; assert $state equals 0
}
@test 'akamai' { # Manage and configure Akamai from the Command Line.
run zinit id-as'akamai' lbin'!akamai*->akamai' for @akamai/cli; assert $state equals 0
run zinit id-as'akamai' lbin"!akamai*->akamai" for @akamai/cli; assert $state equals 0
local cli="$ZBIN/akamai"; assert "$cli" is_executable
run "$cli" --version; assert $state equals 0
}
Expand Down Expand Up @@ -143,11 +143,11 @@
local cog="$ZBIN/cog"; assert "$cog" is_executable
run $cog --version; assert $state equals 0
}
@test 'compress' { # Optimized Go Compression Packages
run zinit bpick'*.tar.gz' lbin'!s2c;s2d;s2sx;' for @klauspost/compress; assert $state equals 0
local compress="$ZBIN/s2c"; assert "$compress" is_executable
run $compress --help; assert $state equals 0
}
# @test 'compress' { # Optimized Go Compression Packages
# run zinit bpick'*.tar.gz' lbin'!s2c;s2d;s2sx;' for @klauspost/compress; assert $state equals 0
# local compress="$ZBIN/s2c"; assert "$compress" is_executable
# run $compress --help; assert $state equals 0
# }
@test 'create-go-app' { # Create a new production-ready project with backend, frontend and deploy automation by running one CLI command
run zinit for id-as'cgapp' @create-go-app/cli; assert $state equals 0
local cgapp="$ZBIN/cgapp"; assert "$cgapp" is_executable
Expand Down Expand Up @@ -196,7 +196,7 @@
run $credential_desktop version; assert $state equals 0
}
@test 'documize' { # Modern Confluence alternative designed for internal & external docs, built with Go & Ember JS
run zinit for id-as'documize' @documize/community; assert $state equals 0
run zinit for @documize/community; assert $state equals 0
local documize="$ZBIN/documize"; assert "$documize" is_executable
run $documize version; assert $state equals 0
}
Expand Down Expand Up @@ -454,7 +454,7 @@
run $insect help; assert $state equals 0
}
@test 'ipinfo' { # Official Command Line Interface for the IPinfo API (IP geolocation and other types of IP data)
run zinit for id-as'ipinfo' @ipinfo/cli; assert $state equals 0
run zinit for @ipinfo/cli; assert $state equals 0
local cli="$ZBIN/ipinfo"; assert "$cli" is_executable
run "$cli" --version; assert $state equals 0
}
Expand Down
6 changes: 2 additions & 4 deletions tests/plugins.zunit
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/usr/bin/env zunit

@setup {
HOME="$zi_dir"
HOME="$zi_test_dir"
# ZBIN="$zi_dir/polaris/bin"
typeset -gx ZBIN="$zi_dir/polaris/bin"
# zinit zstatus
+zi-log '{bar}{nl}{rst}'
typeset -gx ZBIN="$zi_test_dir/polaris/bin"
}

# @test 'cmatrix' {
Expand Down
50 changes: 32 additions & 18 deletions zinit-install.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -1613,7 +1613,7 @@ ziextract() {

if (( auto )) {
# First try known file extensions
local -a files
local -aU files
integer ret_val
files=( (#i)**/*.(zip|rar|7z|tgz|tbz|tbz2|tar.gz|tar.bz2|tar.7z|txz|tar.xz|gz|xz|tar|dmg|exe)~(*/*|.(_backup|git))/*(-.DN) )
for file ( $files ) {
Expand All @@ -1622,7 +1622,7 @@ ziextract() {
}
# Second, try to find the archive via `file' tool
if (( !${#files} )) {
local -aU output infiles stage2_processed archives
local -a output infiles stage2_processed archives
infiles=( **/*~(._zinit*|._backup|.git)(|/*)~*/*/*(-.DN) )
output=( ${(@f)"$(command file -- $infiles 2>&1)"} )
archives=( ${(M)output[@]:#(#i)(* |(#s))(zip|rar|xz|7-zip|gzip|bzip2|tar|exe|PE32) *} )
Expand Down Expand Up @@ -1693,10 +1693,10 @@ ziextract() {
.zinit-extract-wrapper() {
local file="$1" fun="$2" retval
(( !OPTS[opt_-q,--quiet] )) && \
+zi-log "{info}[{pre}ziextract{info}]{rst} Unpacking the files from: \`{obj}$file{msg}'{…}{rst}"
+zi-log "{m} Extracting files in {obj}$file{rst}"
$fun; retval=$?
if (( retval == 0 )) {
local -a files
local -aU files
files=( *~(._zinit*|._backup|.git|.svn|.hg|$file)(DN) )
(( ${#files} && !norm )) && command rm -f "$file"
}
Expand All @@ -1709,25 +1709,37 @@ ziextract() {

case "${${ext:+.$ext}:-$file}" in
((#i)*.zip)
→zinit-extract() { →zinit-check unzip "$file" || return 1; command unzip -o "$file"; }
→zinit-extract(){
→zinit-check unzip "$file" || return 1
command tar -xzf "${file}" --strip-components=1
}
;;
((#i)*.rar)
→zinit-extract() { →zinit-check unrar "$file" || return 1; command unrar x "$file"; }
→zinit-extract() { →zinit-check unrar "$file" || return 1; command unrar x "${file}"; }
;;
((#i)*.tar.bz2|(#i)*.tbz|(#i)*.tbz2)
→zinit-extract() { →zinit-check bzip2 "$file" || return 1; command bzip2 -dc "$file" | command tar -xf -; }
→zinit-extract() { →zinit-check bzip2 "$file" || return 1; local i; for i (0 1); do command tar -xjf "${file}" --strip-components=$i; done && rm -f ${file};
}
;;
((#i)*.tar.gz|(#i)*.tgz)
→zinit-extract() { →zinit-check gzip "$file" || return 1; command gzip -dc "$file" | command tar -xf -; }
→zinit-extract() {
# →zinit-check gzip "$file" || return 1
local i;
for i in 0 1; do
command tar -xf "${file}" --strip-components=$i;
[[ -n ${${file:P}:h}/*(#qx.N) ]] && break
done
rm -rf ${file//[.]t(ar[.]|)gz/}(/N) ${file}
}
;;
((#i)*.tar.xz|(#i)*.txz)
→zinit-extract() { →zinit-check xz "$file" || return 1; command xz -dc "$file" | command tar -xf -; }
→zinit-extract() { →zinit-check xz "$file" || return 1; local i; for i (0 1); do command tar -xzf "${file}" --strip-components=$i; done && rm -f ${file}; }
;;
((#i)*.tar.7z|(#i)*.t7z)
→zinit-extract() { →zinit-check 7z "$file" || return 1; command 7z x -so "$file" | command tar -xf -; }
→zinit-extract() { →zinit-check 7z "$file" || return 1; command 7z x -so "$file" | command tar -xf - --strip-components=0; rm -f ${file}; }
;;
((#i)*.tar)
→zinit-extract() { →zinit-check tar "$file" || return 1; command tar -xf "$file"; }
→zinit-extract() { →zinit-check tar "$file" || return 1; command tar -xzf "${file}" --strip-components=0; rm -f $file; }
;;
((#i)*.gz|(#i)*.gzip)
if [[ $file != (#i)*.gz ]] {
Expand Down Expand Up @@ -1829,7 +1841,7 @@ ziextract() {
}
unfunction -- .zinit-extract-wrapper

local -a execs
local -aU execs
execs=( **/*~(._zinit(|/*)|.git(|/*)|.svn(|/*)|.hg(|/*)|._backup(|/*))(DN-.) )
if [[ ${#execs} -gt 0 && -n $execs ]] {
execs=( ${(@f)"$( file ${execs[@]} )"} )
Expand All @@ -1842,7 +1854,7 @@ ziextract() {
command chmod a+x "${execs[@]}"
if (( !OPTS[opt_-q,--quiet] )) {
if (( ${#execs} == 1 )); then
+zi-log "{info}[{pre}ziextract{info}]{rst} Successfully extracted and assigned +x chmod to the file: {obj}${execs[1]}{rst}."
+zi-log "{m} Extracted and assigned +x chmod to {file}${execs[1]}{rst}"
else
local sep="$ZINIT[col-rst],$ZINIT[col-obj] "
if (( ${#execs} > 7 )) {
Expand Down Expand Up @@ -1897,7 +1909,7 @@ ziextract() {
"(\`{file}$local_dir{msg2}') isn't accessible.{rst}"
return 1
}
local -a files
local -aU files
files=( ${(@)${(@s: :)${extract##(\!-|-\!|\!|-)}}//(#b)(((#s)|([^\\])[\\]([\\][\\])#)|((#s)|([^\\])([\\][\\])#)) /${match[2]:+$match[3]$match[4] }${match[5]:+$match[6]${(l:${#match[7]}/2::\\:):-} }} )
if [[ ${#files} -eq 0 && -n ${extract##(\!-|-\!|\!|-)} ]] {
+zi-log "{error}ERROR:{msg2} The files" \
Expand Down Expand Up @@ -2243,25 +2255,27 @@ zimv() {
local -i ret=0
{
build="make -C ${dir} --jobs 4"
+zi-log "{m} ${ice} {faint}${(Ds; ;)build} $make_prefix=$(builtin print -Pnf '%s' ${(D)ZINIT[ZPFX]}){rst}"
+zi-log "{m} ${ice} Building..."
# +zi-log "{m} ${ice} {faint}${(Ds; ;)build} $make_prefix=$(builtin print -Pnf '%s' ${(D)ZINIT[ZPFX]}){rst}"
+zi-log "{dbg} ${ice} eval ${build} $make_prefix=$prefix 2>/dev/null 1>&2"
eval "${build} $make_prefix=$prefix" 2>/dev/null 1>&2
ret=$?
} always {
if (( ret )); then
+zi-log "{w} ${ice} build returned {num}${ret}{rst}"
+zi-log "{w} ${ice} Build returned {num}${ret}{rst}"
fi
(( TRY_BLOCK_ERROR = 0 ))
}
{
install="${build} ${make}"
+zi-log "{m} ${ice} {faint}${(Ds; ;)build} $make_prefix=$(builtin print -Pnf '%s' ${(D)ZINIT[ZPFX]}) ${make} {rst}"
# +zi-log "{m} ${ice} {faint}${(Ds; ;)build} $make_prefix=$(builtin print -Pnf '%s' ${ZINIT[POLARIS]}) ${make} {rst}"
+zi-log "{m} ${ice} Installing in ${(D)ZINIT[ZPFX]}"
+zi-log "{dbg} ${ice} eval ${build} $make_prefix=$prefix ${make} 2>/dev/null 1>&2"
eval "${(s; ;)install} $make_prefix=$prefix" 2>/dev/null 1>&2
ret=$?
} always {
if (( ret )); then
+zi-log "{w} ${ice} install returned {num}${ret}{rst}"
+zi-log "{w} ${ice} Install returned {num}${ret}{rst}"
fi
(( TRY_BLOCK_ERROR = 0 ))
}
Expand Down

0 comments on commit 44e4c7b

Please sign in to comment.