Skip to content

Commit

Permalink
fix: remove lobal parameter
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Doster <[email protected]>
  • Loading branch information
vladdoster committed Feb 11, 2024
1 parent 4acabc8 commit 98c3162
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 30 deletions.
21 changes: 21 additions & 0 deletions tests/commands.zunit
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,27 @@
assert $output contains "==> Compiling history-search-multi-word.plugin.zsh [OK]"
}

@test 'compile command' {
run zinit for id-as"compile-command" @zdharma-continuum/history-search-multi-word

run perl -pe 's/\x1b\[[0-9;]*[mG]//g' <(zinit compile --quiet compile-command)
assert $state equals 0
assert $output contains "==> Compiling history-search-multi-word.plugin.zsh [OK]"

run perl -pe 's/\x1b\[[0-9;]*[mG]//g' <(zinit compiled)
assert $state equals 0
assert $output contains 'compile-command:'

run perl -pe 's/\x1b\[[0-9;]*[mG]//g' <(zinit uncompile --quiet compile-command)
assert $state equals 0; assert $output contains '==> Uncompiling compile-command [OK]'
}

@test 'uncompile --all' {
zinit uncompile --all --quiet
run zinit compiled; assert $state equals 0
assert $output contains 'No compiled plugins'
}

@test 'self-update' {
run zinit self-update
assert $output contains 'Already up-to-date.'
Expand Down
13 changes: 4 additions & 9 deletions zinit-autoload.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -1142,8 +1142,8 @@ ZINIT[EXTENDED_GLOB]=""
# $2 - plugin (only when $1 - i.e. user - given)
.zinit-uncompile-plugin () {
emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
setopt extendedglob warncreateglobal typesetsilent noshortloops rcquotes
local id_as=$1${2:+${${${(M)1:#%}:+$2}:-/$2}} first plugin_dir filename is_snippet
setopt extended_glob no_short_loops rc_quotes warn_create_global
local id_as=$1${2:+${${${(M)1:#%}:+$2}:-/$2}} filename first is_snippet m plugin_dir
local -a list
local -A ICE
.zinit-compute-ice "$id_as" "pack" ICE plugin_dir filename is_snippet || return 1
Expand All @@ -1160,20 +1160,15 @@ ZINIT[EXTENDED_GLOB]=""
integer retval
(( !$#quiet )) && +zi-log -n "{m} Removing: "
for m in ${plugin_dir}/*.zwc(.N); do
command rm -f ${m:A}
command rm -f "${m:A}"
retval+=$?
(( !$#quiet )) && { +zi-log -n "{file}${m:t}{rst} " }
(( !$#quiet )) && +zi-log -n "{file}${m:t}{rst} "
done
if (( retval )) {
+zi-log " [exit code: {ehi}$retval{rst}]"
} else {
+zi-log " [{happy}OK{rst}]"
}
# fi
# else
# if (( !$#quiet )); then
# +zi-log "${id_as} not compiled"
# fi
fi
} # ]]]

Expand Down
33 changes: 12 additions & 21 deletions zinit.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -2986,11 +2986,9 @@ You can try to prepend {apo}${___q}{lhi}@{apo}'{error} to the ID if the last ice
.zinit-show-report "${2%%(///|//|/)}" "${3%%(///|//|/)}"; ___retval=$?
fi
;;
(plugins)
.zinit-list-plugins "$2"
(plugins) .zinit-list-plugins "$2"
;;
(snippets)
.zinit-list-snippets "$2"
(snippets) .zinit-list-snippets "$2"
;;
(completions) # Show installed, enabled or disabled, completions and detect stray and improper ones
.zinit-show-completions "$2"
Expand Down Expand Up @@ -3062,29 +3060,25 @@ You can try to prepend {apo}${___q}{lhi}@{apo}'{error} to the ID if the last ice
(( ${+functions[.zinit-forget-completion]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-install.zsh" || return 1
.zinit-compinit; ___retval=$?
;;
(compiled) .zinit-compiled
;;
(compile|uncompile)
(( ${+functions[.zinit-compile-plugin]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-autoload.zsh" || return 1
local action="$1" all help quiet
local action="$1" all f help quiet
shift
zparseopts -D -F -K -- {a,-all}=all {h,-help}=help {q,-quiet}=quiet || return
if (( $#help )); then
print -rC1 -- \
"Usage: zinit $action [OPTIONS]" \
" " \
"Remove unused data" \
" " \
+zi-log "Usage: zinit ${action} [OPTIONS]" \
"{nl}${action} plugins{nl}" \
"Options:" \
" -a, --all Remove all unused images not just dangling ones" \
" -f, --force Do not prompt for confirmation"
return 0
" -q, --quiet Remove all unused images not just dangling ones"
fi
if (( $#all )); then
.zinit-compile-uncompile-all ${action}
___retval=$?
.zinit-compile-uncompile-all ${action}; ___retval=$?
else
local f
for f in ${(q+)^@}; do
.zinit-${action}-plugin "$f"
.zinit-${action}-plugin "$f"; (( ___retval += $? ))
done
fi
;;
Expand All @@ -3093,11 +3087,8 @@ You can try to prepend {apo}${___q}{lhi}@{apo}'{error} to the ID if the last ice
(( ${+functions[+zinit-debug]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-additional.zsh"
+zinit-debug $@
;;
(compiled)
.zinit-compiled
;;
(cdlist)
.zinit-list-compdef-replay

(cdlist) .zinit-list-compdef-replay
;;
(cd|recall|edit|glance|changes|create|stress)
.zinit-"$1" "${@[2-correct,-1]%%(///|//|/)}"; ___retval=$?
Expand Down

0 comments on commit 98c3162

Please sign in to comment.