Skip to content

Commit

Permalink
fix: compile and completion log messages
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
  • Loading branch information
vladdoster committed May 4, 2023
1 parent c4e6cb3 commit c4446da
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 28 deletions.
6 changes: 3 additions & 3 deletions doc/zsdoc/zinit-install.zsh.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ ____
____

Has 87 line(s). Calls functions:
Has 83 line(s). Calls functions:

.zinit-compile-plugin
|-- zinit-side.zsh/.zinit-compute-ice
Expand Down Expand Up @@ -349,7 +349,7 @@ ____
____

Has 61 line(s). Calls functions:
Has 62 line(s). Calls functions:

.zinit-install-completions
|-- .zinit-compinit
Expand Down Expand Up @@ -850,7 +850,7 @@ ____
____

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_

Expand Down
4 changes: 2 additions & 2 deletions doc/zsdoc/zinit.zsh.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1891,7 +1891,7 @@ ____
____

Has 134 line(s). Doesn't call other functions.
Has 117 line(s). Doesn't call other functions.

Called by:

Expand All @@ -1914,7 +1914,7 @@ ____
____

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_

Expand Down
39 changes: 18 additions & 21 deletions zinit-install.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -584,16 +584,17 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
fi
done

if (( quiet == 1 && (${#INSTALLED_COMPS} || ${#SKIPPED_COMPS}) )) {
+zinit-message "{msg}Installed {num}${#INSTALLED_COMPS}" \
"{msg}completions. They are stored in the{var}" \
"\$INSTALLED_COMPS{msg} array."
if (( ${#SKIPPED_COMPS} )) {
+zinit-message "{msg}Skipped installing" \
"{num}${#SKIPPED_COMPS}{msg} completions." \
"They are stored in the {var}\$SKIPPED_COMPS{msg} array."
}
}
local comps msg
local -A comp_types=(\$INSTALLED_COMPS 'Installed' \$SKIPPED_COMPS 'Skipped re-installing')
for comps msg in ${(kv)comp_types}; do
local comps_num=${#${(e)comps}}
if (( comps_num > 0 )); then
+zinit-message "{m} ${msg} {num}$comps_num{rst} completion${=${comps_num:#1}:+s}"
if (( quiet == 0 )); then
+zinit-message "{m} Added $comps_num completion${=${comps_num:#1}:+s} to {var}$comps{rst} array"
fi
fi
done

if (( ZSH_SUBSHELL )) {
builtin print -rl -- $INSTALLED_COMPS >! ${TMPDIR:-/tmp}/zinit.installed_comps.$$.lst
Expand Down Expand Up @@ -847,12 +848,12 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
if [[ -f $plugin_dir/$filename ]] {
reply=( "$plugin_dir" $plugin_dir/$filename )
} elif { ! .zinit-first % "$plugin_dir" } {
+zinit-message "No files for compilation found."
+zinit-message "{m} No files for compilation found"
return 1
}
} else {
.zinit-first "$1" "$2" || {
+zinit-message "No files for compilation found."
+zinit-message "{m} No files for compilation found"
return 1
}
}
Expand All @@ -861,15 +862,15 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
first=${reply[-1]}
local fname=${first#$pdir_path/}

+zinit-message -n "{note}Note:{rst} Compiling{ehi}:{rst} {b}{file}$fname{rst}{…}"
+zinit-message -n "{m} Compiling {file}$fname{rst}"
if [[ -z ${ICE[(i)(\!|)(sh|bash|ksh|csh)]} ]] {
() {
builtin emulate -LR zsh -o extendedglob ${=${options[xtrace]:#off}:+-o xtrace}
if { ! zcompile -U "$first" } {
+zinit-message "{msg2}Warning:{rst} Compilation failed. Don't worry, the plugin will work also without compilation."
+zinit-message "{msg2}Warning:{rst} Consider submitting an error report to Zinit or to the plugin's author."
} else {
+zinit-message " {ok}OK{rst}."
+zinit-message " [{happy}OK{rst}]"
}
# Try to catch possible additional file
zcompile -U "${${first%.plugin.zsh}%.zsh-theme}.zsh" 2>/dev/null
Expand All @@ -886,7 +887,7 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
eval "list+=( \$plugin_dir/$~pat(N) )"
}
if [[ ${#list} -eq 0 ]] {
+zinit-message "{u-warn}Warning{b-warn}:{rst} ice {ice}compile{apo}''{rst} didn't match any files."
+zinit-message "{w} ice {ice}compile{apo}''{rst} didn't match any files."
} else {
integer retval
for first in $list; do
Expand All @@ -896,13 +897,9 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
}
done
builtin print -rl -- ${list[@]#$plugin_dir/} >! ${TMPDIR:-/tmp}/zinit.compiled.$$.lst
+zinit-message -n "{m} {num}${#list}{rst} compiled file${=${list:#1}:+s} added to {var}\$ADD_COMPILED{rst} array"
if (( retval )) {
+zinit-message "{note}Note:{rst} The additional {num}${#list}{rst} compiled files" \
"are listed in the {var}\$ADD_COMPILED{rst} array (operation exit" \
"code: {ehi}$retval{rst})."
} else {
+zinit-message "{note}Note:{rst} The additional {num}${#list}{rst} compiled files" \
"are listed in the {var}\$ADD_COMPILED{rst} array."
+zinit-message " (exit code: {ehi}$retval{rst})"
}
}
fi
Expand Down
4 changes: 2 additions & 2 deletions zinit.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ if [[ -z $SOURCED && ( ${+terminfo} -eq 1 && -n ${terminfo[colors]} ) || ( ${+te
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-i $'\e[0;32m'"==>"$'\e[0m' col-e $'\e[1;91m'"Error: "$'\e[0m'
col-m $'\e[0;35m'"==>"$'\e[0m' col-w $'\e[0;33m'"Warning: "$'\e[0m'
col-i $'\e[1m\e[38;5;82m'"==>"$'\e[0m' col-e $'\e[1m\e[38;5;204m'"Error: "$'\e[0m'
col-m $'\e[1m\e[38;5;135m'"==>"$'\e[0m' col-w $'\e[1;38;5;214m'"Warning: "$'\e[0m'

col--… "${${${(M)LANG:#*UTF-8*}:+⋯⋯}:-···}" col-lr "${${${(M)LANG:#*UTF-8*}:+↔}:-"«-»"}"
col-ndsh "${${${(M)LANG:#*UTF-8*}:+–}:-}" col-… "${${${(M)LANG:#*UTF-8*}:+…}:-...}"
Expand Down

0 comments on commit c4446da

Please sign in to comment.