mirror of
https://github.com/zdharma-continuum/zinit.git
synced 2026-09-10 07:36:38 -04:00
Merge branch 'main' into fix/handle-bsd-realpath
This commit is contained in:
commit
061dd62e1e
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
|
|
@ -11,7 +11,7 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '18'
|
||||
node-version: '20'
|
||||
|
||||
- name: Fetch dependencies
|
||||
run: |
|
||||
|
|
|
|||
24
.github/workflows/tests.yaml
vendored
24
.github/workflows/tests.yaml
vendored
|
|
@ -68,34 +68,20 @@ jobs:
|
|||
git clone --depth 1 https://github.com/zdharma-continuum/zunit; cd ./zunit
|
||||
zsh -l -c './build.zsh' && sudo chmod u+x ./zunit && cp ./zunit "$HOME/.local/bin/"
|
||||
|
||||
- name: "gh-r"
|
||||
shell: zsh {0}
|
||||
run: $HOME/.local/bin/zunit run --verbose tests/gh-r.zunit
|
||||
|
||||
- name: "annexes"
|
||||
run: zunit run tests/annexes.zunit
|
||||
|
||||
|
||||
- name: "commands"
|
||||
run: zunit run tests/commands.zunit
|
||||
|
||||
|
||||
- name: "gh-r"
|
||||
run: zunit run tests/gh-r.zunit
|
||||
|
||||
|
||||
- name: "ices"
|
||||
run: zunit run tests/ices.zunit
|
||||
|
||||
|
||||
- name: "plugins"
|
||||
run: zunit run tests/plugins.zunit
|
||||
|
||||
|
||||
- name: "snippets"
|
||||
run: zunit run tests/snippets.zunit
|
||||
|
||||
# - name: Run tests
|
||||
# shell: zsh {0}
|
||||
# run: |
|
||||
# command -p ls -1 ./tests/*zunit \
|
||||
# | parallel \
|
||||
# --jobs=2 \
|
||||
# --keep-order \
|
||||
# --line-buffer \
|
||||
# $HOME/.local/bin/zunit run
|
||||
|
|
|
|||
21
CHANGELOG.md
21
CHANGELOG.md
|
|
@ -1,3 +1,24 @@
|
|||
# [3.13.0](https://github.com/zdharma-continuum/zinit/compare/v3.12.1...v3.13.0) (2024-01-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **ci:** remove duplicate gh-r zunit job ([#623](https://github.com/zdharma-continuum/zinit/issues/623)) ([70cefc0](https://github.com/zdharma-continuum/zinit/commit/70cefc086a8b2277476e7f4fa3e00e0f7d4fd4cf))
|
||||
* debug logging logic and format ([#592](https://github.com/zdharma-continuum/zinit/issues/592)) ([3c7e5be](https://github.com/zdharma-continuum/zinit/commit/3c7e5be07d79b8f1a7fbd5dfd150a09a6309e461))
|
||||
* handle zinit --help ([#597](https://github.com/zdharma-continuum/zinit/issues/597)) ([8cf9104](https://github.com/zdharma-continuum/zinit/commit/8cf9104ac08da3f7f108a32e0a3b117e22681d46))
|
||||
* link ice check in .zinit-download-snippet function ([#608](https://github.com/zdharma-continuum/zinit/issues/608)) ([358ef03](https://github.com/zdharma-continuum/zinit/commit/358ef03785a18e694e94fd4560e0582c4024bcc3))
|
||||
* pin dua gh-r test to v2.20.3 ([#605](https://github.com/zdharma-continuum/zinit/issues/605)) ([0ba778a](https://github.com/zdharma-continuum/zinit/commit/0ba778ac734e33c960fe08bbd56a351b1b86dcd4))
|
||||
* silence unzip command in ziextract ([#614](https://github.com/zdharma-continuum/zinit/issues/614)) ([71764bf](https://github.com/zdharma-continuum/zinit/commit/71764bf2caa553f52435ed374bb48b74b0a8ad96))
|
||||
* tar permissions when `ziextract` ran as root user ([#557](https://github.com/zdharma-continuum/zinit/issues/557)) ([e2d477c](https://github.com/zdharma-continuum/zinit/commit/e2d477cde4e87d13ebc6b99e7f95022f75ca075e))
|
||||
* update labeler config to v5 ([#604](https://github.com/zdharma-continuum/zinit/issues/604)) ([794723c](https://github.com/zdharma-continuum/zinit/commit/794723cc4829e0f9293fc441100913ac7f02566a))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* configure, make, cmake, and build ices ([#613](https://github.com/zdharma-continuum/zinit/issues/613)) ([#616](https://github.com/zdharma-continuum/zinit/issues/616)) ([22e66db](https://github.com/zdharma-continuum/zinit/commit/22e66db478716005d6fec52cd412fad3fc94a9a2))
|
||||
* **delete:** fix unsetting plugin state & add `--debug` / `--quiet` flags ([#622](https://github.com/zdharma-continuum/zinit/issues/622)) ([3f4b685](https://github.com/zdharma-continuum/zinit/commit/3f4b68562265e6b06f55124e34fab0fe58c53adf))
|
||||
* remove zpextract and use ziextract ([#611](https://github.com/zdharma-continuum/zinit/issues/611)) ([2ccac85](https://github.com/zdharma-continuum/zinit/commit/2ccac85e376965a6e6d9fe1dc3f1470b706e9fac))
|
||||
|
||||
## [3.12.1](https://github.com/zdharma-continuum/zinit/compare/v3.12.0...v3.12.1) (2023-11-20)
|
||||
|
||||
|
||||
|
|
|
|||
10
_zinit
10
_zinit
|
|
@ -202,13 +202,15 @@ _zinit_cunistall(){
|
|||
# FUNCTION: _zinit_delete [[[
|
||||
_zinit_delete(){
|
||||
_arguments \
|
||||
'--help[Show this help message]' \
|
||||
'--quiet[Turn off messages from the operation]' \
|
||||
'--yes[Automatically confirm any yes/no prompts]' \
|
||||
{-d,--debug}'[Enable xtrace]' \
|
||||
{-h,--help}'[Show this help message]' \
|
||||
{-q,--quiet}'[Make some output more quiet]' \
|
||||
{-y,--yes}'[Automatically confirm any yes/no prompts]' \
|
||||
+ '(operation)' \
|
||||
'*::installed:__zinit_installed' \
|
||||
{-a,--all}'[Delete all plugins and snippets]' \
|
||||
{-c,--clean}'[Delete only the currently-not loaded plugins and snippets]'
|
||||
{-c,--clean}'[Delete only the currently-not loaded plugins and snippets]' \
|
||||
&& ret=0
|
||||
} # ]]]
|
||||
_zinit_debug(){
|
||||
_arguments \
|
||||
|
|
|
|||
|
|
@ -37,12 +37,17 @@
|
|||
}
|
||||
|
||||
@test 'plugins' {
|
||||
run zinit plugins
|
||||
assert $output contains 'Plugins'
|
||||
assert $output contains 'Unloaded: '
|
||||
assert $output contains 'Loaded: '
|
||||
run perl -pe 's/\x1b\[[0-9;]*[mG]//g' <(zinit plugins)
|
||||
assert $state equals 0
|
||||
assert $output contains "==> 5 Plugins"
|
||||
assert $output contains 'Loaded: L | Unloaded: U'
|
||||
}
|
||||
@test 'plugins with keyword' {
|
||||
run perl -pe 's/\x1b\[[0-9;]*[mG]//g' <(zinit plugins zdharma)
|
||||
assert $state equals 0
|
||||
assert $output contains "==> 4 Plugins matching 'zdharma'"
|
||||
}
|
||||
|
||||
@test 'help' {
|
||||
for cmd in 'help' '-h' '--help'; do
|
||||
run zinit $cmd
|
||||
|
|
|
|||
|
|
@ -1194,13 +1194,16 @@ EOF
|
|||
builtin print "You're in plugin's repository folder, the files aren't added to git."
|
||||
fi
|
||||
} # ]]]
|
||||
|
||||
# FUNCTION: .zinit-delete [[[
|
||||
# Deletes a plugin or snippet and related files and hooks.
|
||||
# Deletes a plugin or snippet and related files and hooks
|
||||
#
|
||||
# $1 - snippet url or plugin
|
||||
.zinit-delete () {
|
||||
setopt local_options extended_glob no_ksh_arrays no_ksh_glob null_glob typeset_silent warn_create_global
|
||||
local o_all o_clean o_debug o_help o_verbose o_yes rc
|
||||
emulate -LR zsh
|
||||
setopt extended_glob no_ksh_arrays no_ksh_glob typeset_silent warn_create_global
|
||||
+zi-log "{dbg} $0: ${(qqS)@}"
|
||||
local o_all o_clean o_debug o_help o_quiet o_yes rc
|
||||
local -a usage=(
|
||||
'Usage:'
|
||||
' zinit delete [options] [plugins...]'
|
||||
|
|
@ -1208,21 +1211,27 @@ EOF
|
|||
'Options:'
|
||||
' -a, --all Delete all installed plugins, snippets, and completions'
|
||||
' -c, --clean Delete unloaded plugins and snippets'
|
||||
' -d, --debug Enable debug mode'
|
||||
' -h, --help Show list of command-line options'
|
||||
' -q, --quiet Make some output more quiet'
|
||||
' -y, --yes Don´t prompt for user confirmation'
|
||||
)
|
||||
zmodload zsh/zutil
|
||||
zparseopts -D -E -F -K -- \
|
||||
{a,-all}=o_all \
|
||||
{c,-clean}=o_clean \
|
||||
{d,-dry-run}=o_debug \
|
||||
{d,-debug}=o_debug \
|
||||
{h,-help}=o_help \
|
||||
{q,-quiet}=o_quiet \
|
||||
{y,-yes}=o_yes \
|
||||
|| return 1
|
||||
(( $#o_help )) && {
|
||||
print -l -- $usage
|
||||
print -l -- ${usage}
|
||||
return 0
|
||||
}
|
||||
(( $#o_debug )) && {
|
||||
setopt xtrace
|
||||
}
|
||||
(( $#o_clean && $#o_all )) && {
|
||||
+zi-log "{e} Invalid usage: Options --all and --clean are mutually exclusive"
|
||||
return 1
|
||||
|
|
@ -1245,7 +1254,7 @@ EOF
|
|||
(( $#del_list || $#unld_plgns || $#unld_snips )) && {
|
||||
(( $#unld_snips )) && +zi-log "{m} Deleting {num}${#unld_snips}{rst} unloaded snippets:" $unld_snips
|
||||
(( $#unld_plgns )) && +zi-log "{m} Deleting {num}${#unld_plgns}{rst} unloaded plugins:" $unld_plgns
|
||||
if (( $#o_yes )) || (.zinit-prompt "Delete ${#unld_snips} snippets and ${#unld_plgns} plugins?"); then
|
||||
if (( $#o_yes )) || ( .zinit-prompt "Delete ${#unld_snips} snippets and ${#unld_plgns} plugins?" ); then
|
||||
for snip in $del_list $unld_plgns $unld_snips; do
|
||||
zinit delete --yes "$snip"
|
||||
_retval+=$?
|
||||
|
|
@ -1261,16 +1270,24 @@ EOF
|
|||
}
|
||||
local i
|
||||
if (( $#o_all && !$#o_clean )); then
|
||||
local -a all_installed=($(cat "${ZINIT[HOME_DIR]}"/{'snippets','plugins'}/*/(*/)#teleid(N)))
|
||||
if (( $#o_yes )) || (.zinit-prompt "Delete all plugins and snippets (${#all_installed} total)"); then
|
||||
for i in $all_installed; do
|
||||
condition () {
|
||||
if [[ -e "${REPLY:h}"/id-as ]]; then
|
||||
reply+=("$(cat "${REPLY:h}/id-as")")
|
||||
else
|
||||
reply+=("$(cat "${REPLY:A}")")
|
||||
fi
|
||||
}
|
||||
local -a all_installed=("${ZINIT[HOME_DIR]}"/{'plugins','snippets'}/**/\._zinit/teleid(N+condition))
|
||||
if (( $#o_yes )) || ( .zinit-prompt "Delete all plugins and snippets ($#all_installed total)" ); then
|
||||
for i in ${all_installed[@]}; do
|
||||
zinit delete --yes "${i}"
|
||||
done
|
||||
command rm -f -- "${ZINIT[HOME_DIR]}"/**/*(-@N)
|
||||
for f in ${(M)${(k)ZINIT[@]}:##STATES__*~*local/zinit*}; do
|
||||
builtin unset "ZINIT[$f]"
|
||||
rc=$?
|
||||
command rm -d -f -v "${ZINIT[HOME_DIR]}"/**/*(-@N) "${ZINIT[HOME_DIR]}"/{'plugins','snippets'}/*(N/^F)
|
||||
local f
|
||||
for f in ${(k)ZINIT[(I)STATES__*~*local/zinit]}; do
|
||||
builtin unset "ZINIT[${f}]"
|
||||
done
|
||||
local rc=$?
|
||||
+zi-log "{m} Delete completed with return code {num}${rc}{rst}"
|
||||
return $rc
|
||||
fi
|
||||
|
|
@ -1280,8 +1297,8 @@ EOF
|
|||
+zi-log "{e} Invalid usage: This command requires at least 1 plugin or snippet argument."
|
||||
return 0
|
||||
}
|
||||
if (( $#o_yes )) || (.zinit-prompt "Delete ${(j:, :)@}"); then
|
||||
for i in $@; do
|
||||
if (( $#o_yes )) || ( .zinit-prompt "Delete ${(j:, :)@}" ); then
|
||||
for i in "${@}"; do
|
||||
local -A ICE=() ICE2=()
|
||||
local the_id="${${i:#(%|/)*}}" filename is_snippet local_dir
|
||||
.zinit-compute-ice "$the_id" "pack" ICE2 local_dir filename is_snippet || return 1
|
||||
|
|
@ -1302,10 +1319,9 @@ EOF
|
|||
.zinit-any-to-user-plugin "${ICE2[teleid]}"
|
||||
.zinit-run-delete-hooks plugin "${reply[-2]}" "${reply[-1]}" "$the_id" "$local_dir"
|
||||
}
|
||||
command rm -rf -- ${(q)${${local_dir:#[/[:space:]]##}:-${TMPDIR:-${TMPDIR:-/tmp}}/abcYZX321}}(N)
|
||||
command rm -f -- $ZINIT[HOME_DIR]/**/*(-@N)
|
||||
builtin unset "ZINIT[STATES__${ICE2[id-as]}]" || builtin unset "ZINIT[STATES__${ICE2[teleid]}]"
|
||||
(( quiet )) || +zi-log "{m} Uninstalled {b}$i{rst}"
|
||||
command rm -d -f -r "${ZINIT[HOME_DIR]}"/**/*(-@N) "${ZINIT[HOME_DIR]}"/{'plugins','snippets'}/*(N/^F) ${(q)${${local_dir:#[/[:space:]]##}:-${TMPDIR:-${TMPDIR:-/tmp}}/abcYZX321}}(N)
|
||||
builtin unset "ZINIT[STATES__${i}]" || builtin unset "ZINIT[STATES__${ICE2[teleid]}]"
|
||||
(( $#o_quiet )) || +zi-log "{m} Uninstalled {b}$i{rst}"
|
||||
else
|
||||
+zi-log "{w} No available plugin or snippet with the name '{b}$i{rst}'"
|
||||
return 1
|
||||
|
|
@ -1547,29 +1563,29 @@ print -- "\nAvailable ice-modifiers:\n\n${ice_order[*]}"
|
|||
done
|
||||
} # ]]]
|
||||
# FUNCTION: .zinit-list-plugins [[[
|
||||
# Lists loaded plugins (subcommands list, lodaded)
|
||||
.zinit-list-plugins() {
|
||||
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
||||
setopt extendedglob warncreateglobal typesetsilent noshortloops
|
||||
# Lists loaded plugins
|
||||
.zinit-list-plugins () {
|
||||
builtin emulate -LR zsh
|
||||
setopt extended_glob warn_create_global typeset_silent no_short_loops
|
||||
typeset -a filtered
|
||||
local keyword="$1"
|
||||
keyword="${keyword## ##}"
|
||||
keyword="${keyword%% ##}"
|
||||
if [[ -n "$keyword" ]]; then
|
||||
+zi-log "{i} Installed plugins matching {info}$keyword{rst}:"
|
||||
filtered=( "${(M)ZINIT[@]:#STATES__*$keyword*}" )
|
||||
else
|
||||
filtered=(${${(M)${(k)ZINIT[@]}:##STATES__*}//[A-Z]*__/})
|
||||
fi
|
||||
local i
|
||||
+zi-log '{m} {b}Plugins{rst}'
|
||||
for i in "${(o)filtered[@]}"; do
|
||||
[[ "$i" = "local/zinit" ]] && continue
|
||||
local is_loaded='{error}U'
|
||||
(( ZINIT[STATES__${i}] )) && is_loaded="{happy}L"
|
||||
+zi-log -C2 -- $is_loaded{rst} $i
|
||||
done
|
||||
+zi-log -- '{nl}Loaded: {happy}L{rst} | Unloaded: {error}U{rst}'
|
||||
local keyword="${${${1}## ##}%% ##}"
|
||||
if [[ -n "$keyword" ]]; then
|
||||
+zi-log "{dbg} ${(qqq)1} -> ${(qqq)keyword}{rst}"
|
||||
filtered=(${${(k)ZINIT[(I)STATES__*${keyword}*~*(local/zinit)*]}//[A-Z]*__/})
|
||||
+zi-log "{m} ${#filtered} {b}Plugins{rst} matching '{glob}${keyword}{rst}'"
|
||||
else
|
||||
filtered=(${${(M)${(k)ZINIT[@]}:##STATES__*~*local/zinit*}//[A-Z]*__/})
|
||||
+zi-log "{m} ${#filtered} {b}Plugins{rst}"
|
||||
fi
|
||||
local i
|
||||
local -i idx=1
|
||||
for i in "${(o)filtered[@]}"; do
|
||||
local is_loaded='{error}U'
|
||||
(( ZINIT[STATES__${i}] )) && is_loaded="{happy}L"
|
||||
+zi-log "$(print -f "%2d %s %s\n" ${idx} ${is_loaded} {b}${(D)i//[%]/}{rst})"
|
||||
(( idx+=1 ))
|
||||
done
|
||||
+zi-log -- '{nl}Loaded: {happy}L{rst} | Unloaded: {error}U{rst}'
|
||||
} # ]]]
|
||||
# FUNCTION: .zinit-list-snippets [[[
|
||||
.zinit-list-snippets() {
|
||||
|
|
@ -1700,7 +1716,7 @@ print -- "\nAvailable ice-modifiers:\n\n${ice_order[*]}"
|
|||
} # ]]]
|
||||
# FUNCTION: .zinit-run-delete-hooks [[[
|
||||
.zinit-run-delete-hooks () {
|
||||
local make_path=$5/Makefile mfest_path=$5/build/install_manifest.txt quiet='2>/dev/null 1>&2'
|
||||
local make_path=$5/Makefile mfest_path=$5/build/install_manifest.txt quiet='2>/dev/null 1>&2'
|
||||
if [[ -f $make_path ]] && grep '^uninstall' $make_path &> /dev/null; then
|
||||
+zi-log -n "{m} Make uninstall... "
|
||||
eval 'command make -C ${make_path:h} {prefix,{,CMAKE_INSTALL_}PREFIX}=$ZINIT[ZPFX] --ignore-errors uninstall' 2>/dev/null 1>&2
|
||||
|
|
@ -1728,9 +1744,9 @@ print -- "\nAvailable ice-modifiers:\n\n${ice_order[*]}"
|
|||
fi
|
||||
local -a arr
|
||||
local key
|
||||
reply=(${(on)ZINIT_EXTS2[(I)zinit hook:atdelete-pre <->]} ${(on)ZINIT_EXTS[(I)z-annex hook:atdelete-<-> <->]} ${(on)ZINIT_EXTS2[(I)zinit hook:atdelete-post <->]})
|
||||
reply=(${(on)ZINIT_EXTS2[(I)zinit hook:atdelete-pre <->]} ${(on)ZINIT_EXTS[(I)z-annex hook:atdelete-<-> <->]} ${(on)ZINIT_EXTS2[(I)zinit hook:atdelete-post <->]})
|
||||
for key in "${reply[@]}"; do
|
||||
arr=("${(Q)${(z@)ZINIT_EXTS[$key]:-$ZINIT_EXTS2[$key]}[@]}")
|
||||
arr=("${(Q)${(z@)ZINIT_EXTS[$key]:-$ZINIT_EXTS2[$key]}[@]}")
|
||||
"${arr[5]}" "$1" "$2" $3 "$4" "$5" "${${key##(zinit|z-annex) hook:}%% <->}" delete:TODO
|
||||
done
|
||||
} # ]]]
|
||||
|
|
|
|||
|
|
@ -222,11 +222,11 @@ if [[ -z $SOURCED && ( ${+terminfo} -eq 1 && -n ${terminfo[colors]} ) || ( ${+te
|
|||
col-ehi $'\e[1m\e[38;5;210m' col-meta $'\e[38;5;57m' col-pname $'\e[1;4m\e[32m' col-var $'\e[38;5;81m'
|
||||
col-error $'\e[1m\e[38;5;204m' col-meta2 $'\e[38;5;147m' col-pre $'\e[38;5;135m' col-version $'\e[3;38;5;87m'
|
||||
col-failure $'\e[38;5;204m' col-msg $'\e[0m' col-profile $'\e[38;5;148m' col-warn $'\e[38;5;214m'
|
||||
|
||||
|
||||
col-dbg $'\e[2m\e[38;47;107m'"[debug]"$'\e[0m'
|
||||
col-e $'\e[1m\e[38;5;204m'"Error"$'\e[0m'":"
|
||||
col-i $'\e[1m\e[38;5;82m'"==>"$'\e[0m'
|
||||
col-m $'\e[1m\e[38;5;135m'"==>"$'\e[0m'
|
||||
col-i $'\e[1m\e[38;5;82m'"==>"$'\e[0m'
|
||||
col-m $'\e[38;5;4m'"==>"$'\e[0m'
|
||||
col-w $'\e[1m\e[38;5;214m'"Warning"$'\e[0m'":"
|
||||
|
||||
col--… "${${${(M)LANG:#*UTF-8*}:+⋯⋯}:-···}" col-lr "${${${(M)LANG:#*UTF-8*}:+↔}:-"«-»"}"
|
||||
|
|
|
|||
Loading…
Reference in a new issue