mirror of
https://github.com/zdharma-continuum/zinit.git
synced 2026-09-10 07:36:38 -04:00
fix: plugins command correctly handles keyword argument (#626)
This commit is contained in:
parent
9ce9ec6367
commit
f26d387e51
|
|
@ -37,12 +37,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@test 'plugins' {
|
@test 'plugins' {
|
||||||
run zinit plugins
|
run perl -pe 's/\x1b\[[0-9;]*[mG]//g' <(zinit plugins)
|
||||||
assert $output contains 'Plugins'
|
|
||||||
assert $output contains 'Unloaded: '
|
|
||||||
assert $output contains 'Loaded: '
|
|
||||||
assert $state equals 0
|
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' {
|
@test 'help' {
|
||||||
for cmd in 'help' '-h' '--help'; do
|
for cmd in 'help' '-h' '--help'; do
|
||||||
run zinit $cmd
|
run zinit $cmd
|
||||||
|
|
|
||||||
|
|
@ -1563,29 +1563,29 @@ print -- "\nAvailable ice-modifiers:\n\n${ice_order[*]}"
|
||||||
done
|
done
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-list-plugins [[[
|
# FUNCTION: .zinit-list-plugins [[[
|
||||||
# Lists loaded plugins (subcommands list, lodaded)
|
# Lists loaded plugins
|
||||||
.zinit-list-plugins() {
|
.zinit-list-plugins () {
|
||||||
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
builtin emulate -LR zsh
|
||||||
setopt extended_glob warn_create_global typeset_silent no_short_loops
|
setopt extended_glob warn_create_global typeset_silent no_short_loops
|
||||||
typeset -a filtered
|
typeset -a filtered
|
||||||
local keyword="$1"
|
local keyword="${${${1}## ##}%% ##}"
|
||||||
keyword="${keyword## ##}"
|
if [[ -n "$keyword" ]]; then
|
||||||
keyword="${keyword%% ##}"
|
+zi-log "{dbg} ${(qqq)1} -> ${(qqq)keyword}{rst}"
|
||||||
if [[ -n "$keyword" ]]; then
|
filtered=(${${(k)ZINIT[(I)STATES__*${keyword}*~*(local/zinit)*]}//[A-Z]*__/})
|
||||||
+zi-log "{i} Installed plugins matching {info}$keyword{rst}:"
|
+zi-log "{m} ${#filtered} {b}Plugins{rst} matching '{glob}${keyword}{rst}'"
|
||||||
filtered=( "${(M)ZINIT[@]:#STATES__*$keyword*}" )
|
else
|
||||||
else
|
filtered=(${${(M)${(k)ZINIT[@]}:##STATES__*~*local/zinit*}//[A-Z]*__/})
|
||||||
filtered=(${${(M)${(k)ZINIT[@]}:##STATES__*}//[A-Z]*__/})
|
+zi-log "{m} ${#filtered} {b}Plugins{rst}"
|
||||||
fi
|
fi
|
||||||
local i
|
local i
|
||||||
+zi-log '{m} {b}Plugins{rst}'
|
local -i idx=1
|
||||||
for i in "${(o)filtered[@]}"; do
|
for i in "${(o)filtered[@]}"; do
|
||||||
[[ "$i" = "local/zinit" ]] && continue
|
local is_loaded='{error}U'
|
||||||
local is_loaded='{error}U'
|
(( ZINIT[STATES__${i}] )) && is_loaded="{happy}L"
|
||||||
(( ZINIT[STATES__${i}] )) && is_loaded="{happy}L"
|
+zi-log "$(print -f "%2d %s %s\n" ${idx} ${is_loaded} {b}${(D)i//[%]/}{rst})"
|
||||||
+zi-log -C2 -- $is_loaded{rst} $i
|
(( idx+=1 ))
|
||||||
done
|
done
|
||||||
+zi-log -- '{nl}Loaded: {happy}L{rst} | Unloaded: {error}U{rst}'
|
+zi-log -- '{nl}Loaded: {happy}L{rst} | Unloaded: {error}U{rst}'
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-list-snippets [[[
|
# FUNCTION: .zinit-list-snippets [[[
|
||||||
.zinit-list-snippets() {
|
.zinit-list-snippets() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue