mirror of
https://github.com/zdharma-continuum/zinit.git
synced 2026-09-10 07:36:38 -04:00
style: update ziextract log messages prefix (#411)
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
This commit is contained in:
parent
f4787dcac8
commit
fcd2aa6791
|
|
@ -515,7 +515,7 @@ ____
|
|||
$2 - file
|
||||
____
|
||||
|
||||
Has 297 line(s). Calls functions:
|
||||
Has 283 line(s). Calls functions:
|
||||
|
||||
ziextract
|
||||
`-- zinit.zsh/+zinit-message
|
||||
|
|
|
|||
|
|
@ -1637,7 +1637,7 @@ ziextract() {
|
|||
local -a opt_move opt_move2 opt_norm opt_auto opt_nobkp
|
||||
zparseopts -D -E -move=opt_move -move2=opt_move2 -norm=opt_norm \
|
||||
-auto=opt_auto -nobkp=opt_nobkp || \
|
||||
{ +zinit-message "{error}ziextract:{msg2} Incorrect options given to" \
|
||||
{ +zinit-message "{info}[{pre}ziextract{info}]{error} Incorrect options given to" \
|
||||
"\`{pre}ziextract{msg2}' (available are: {meta}--auto{msg2}," \
|
||||
"{meta}--move{msg2}, {meta}--move2{msg2}, {meta}--norm{msg2}," \
|
||||
"{meta}--nobkp{msg2}).{rst}"; return 1; }
|
||||
|
|
@ -1671,9 +1671,7 @@ ziextract() {
|
|||
type=${(L)desc/(#b)(#i)(* |(#s))(zip|rar|xz|7-zip|gzip|bzip2|tar|exe|PE32) */$match[2]}
|
||||
if [[ $type = (zip|rar|xz|7-zip|gzip|bzip2|tar|exe|pe32) ]] {
|
||||
(( !OPTS[opt_-q,--quiet] )) && \
|
||||
+zinit-message "{pre}ziextract:{info2} Note:{rst}" \
|
||||
"detected a {meta}$type{rst} archive in the file" \
|
||||
"{file}$fname{rst}."
|
||||
+zinit-message "{info}[{pre}ziextract{info}]{msg2} detected a {meta}$type{rst} archive in the file {file}$fname{rst}."
|
||||
ziextract "$fname" "$type" $opt_move $opt_move2 $opt_norm --norm ${${${#archives}:#1}:+--nobkp}
|
||||
integer iret_val=$?
|
||||
ret_val+=iret_val
|
||||
|
|
@ -1699,9 +1697,7 @@ ziextract() {
|
|||
# this might delete too soon… However, it's unusual case.
|
||||
[[ $fname != $infname && $norm -eq 0 ]] && command rm -f "$infname"
|
||||
(( !OPTS[opt_-q,--quiet] )) && \
|
||||
+zinit-message "{pre}ziextract:{info2} Note:{rst}" \
|
||||
"detected a {obj}${type2}{rst} archive in the" \
|
||||
" file {file}${fname}{rst}."
|
||||
+zinit-message "{info}[{pre}ziextract{info}]{msg2} detected a {obj}${type2}{rst} archive in the file {file}${fname}{rst}."
|
||||
ziextract "$fname" "$type2" $opt_move $opt_move2 $opt_norm ${${${#archives}:#1}:+--nobkp}
|
||||
ret_val+=$?
|
||||
stage2_processed+=( $fname )
|
||||
|
|
@ -1719,13 +1715,11 @@ ziextract() {
|
|||
}
|
||||
|
||||
if [[ -z $file ]] {
|
||||
+zinit-message "{error}ziextract:{msg2} ERROR:{msg} argument" \
|
||||
"needed (the file to extract) or the {meta}--auto{msg} option."
|
||||
+zinit-message "{info}[{pre}ziextract{info}]{error} argument needed (the file to extract) or the {meta}--auto{msg} option."
|
||||
return 1
|
||||
}
|
||||
if [[ ! -e $file ]] {
|
||||
+zinit-message "{error}ziextract:{msg2} ERROR:{msg}" \
|
||||
"the file \`{meta}${file}{msg}' doesn't exist.{rst}"
|
||||
+zinit-message "{info}[{pre}ziextract{info}]{error} ERROR:{msg} the file \`{meta}${file}{msg}' doesn't exist.{rst}"
|
||||
return 1
|
||||
}
|
||||
if (( !nobkp )) {
|
||||
|
|
@ -1737,7 +1731,7 @@ ziextract() {
|
|||
.zinit-extract-wrapper() {
|
||||
local file="$1" fun="$2" retval
|
||||
(( !OPTS[opt_-q,--quiet] )) && \
|
||||
+zinit-message "{pre}ziextract:{msg} Unpacking the files from: \`{obj}$file{msg}'{…}{rst}"
|
||||
+zinit-message "{info}[{pre}ziextract{info}]{rst} Unpacking the files from: \`{obj}$file{msg}'{…}{rst}"
|
||||
$fun; retval=$?
|
||||
if (( retval == 0 )) {
|
||||
local -a files
|
||||
|
|
@ -1748,8 +1742,7 @@ ziextract() {
|
|||
}
|
||||
|
||||
→zinit-check() { (( ${+commands[$1]} )) || \
|
||||
+zinit-message "{error}ziextract:{msg2} Error:{msg} No command {data}$1{msg}," \
|
||||
"it is required to unpack {file}$2{rst}."
|
||||
+zinit-message "{info}[{pre}ziextract{info}]{error} Error:{msg} No command {data}$1{msg}, it is required to unpack {file}$2{rst}."
|
||||
}
|
||||
|
||||
case "${${ext:+.$ext}:-$file}" in
|
||||
|
|
@ -1835,8 +1828,7 @@ ziextract() {
|
|||
command hdiutil detach $attached_vol
|
||||
|
||||
if (( retval )) {
|
||||
+zinit-message "{error}ziextract:{msg2} WARNING:{msg}" \
|
||||
"problem occurred when attempted to copy the files" \
|
||||
+zinit-message "{info}[{pre}ziextract{info}]{error} Error:{msg} problem occurred when attempted to copy the files" \
|
||||
"from the mounted image: \`{obj}${file}{msg}'.{rst}"
|
||||
}
|
||||
return $retval
|
||||
|
|
@ -1858,8 +1850,7 @@ ziextract() {
|
|||
|
||||
if [[ $(typeset -f + →zinit-extract) == "→zinit-extract" ]] {
|
||||
.zinit-extract-wrapper "$file" →zinit-extract || {
|
||||
+zinit-message -n "{error}ziextract:{msg2} WARNING:{msg}" \
|
||||
"extraction of the archive \`{file}${file}{msg}' had problems"
|
||||
+zinit-message -n "{info}[{pre}ziextract{info}]{error} Error:{msg} extraction of the archive \`{file}${file}{msg}' had problems"
|
||||
local -a bfiles
|
||||
bfiles=( ._backup/*(DN) )
|
||||
if (( ${#bfiles} && !nobkp )) {
|
||||
|
|
@ -1889,13 +1880,11 @@ ziextract() {
|
|||
command chmod a+x "${execs[@]}"
|
||||
if (( !OPTS[opt_-q,--quiet] )) {
|
||||
if (( ${#execs} == 1 )); then
|
||||
+zinit-message "{pre}ziextract:{rst}" \
|
||||
"Successfully extracted and assigned +x chmod to the file:" \
|
||||
"\`{obj}${execs[1]}{rst}'."
|
||||
+zinit-message "{info}[{pre}ziextract{info}]{rst} Successfully extracted and assigned +x chmod to the file: {obj}${execs[1]}{rst}."
|
||||
else
|
||||
local sep="$ZINIT[col-rst],$ZINIT[col-obj] "
|
||||
if (( ${#execs} > 7 )) {
|
||||
+zinit-message "{pre}ziextract:{rst} Successfully" \
|
||||
+zinit-message "{info}[{pre}ziextract{info}]{rst} Successfully" \
|
||||
"extracted and marked executable the appropriate files" \
|
||||
"({obj}${(pj:$sep:)${(@)execs[1,5]:t}},…{rst}) contained" \
|
||||
"in \`{file}$file{rst}'. All the extracted" \
|
||||
|
|
@ -1903,19 +1892,15 @@ ziextract() {
|
|||
"available in the {msg2}INSTALLED_EXECS{rst}" \
|
||||
"array."
|
||||
} else {
|
||||
+zinit-message "{pre}ziextract:{rst} Successfully" \
|
||||
"extracted and marked executable the appropriate files" \
|
||||
+zinit-message "{info}[{pre}ziextract{info}]{rst} Successfully" \
|
||||
"extracted and marked {obj}${#execs}{rst} executable the appropriate files" \
|
||||
"({obj}${(pj:$sep:)${execs[@]:t}}{rst}) contained" \
|
||||
"in \`{file}$file{rst}'."
|
||||
}
|
||||
fi
|
||||
}
|
||||
} elif (( warning )) {
|
||||
+zinit-message "{pre}ziextract:" \
|
||||
"{error}WARNING: {msg}didn't recognize the archive" \
|
||||
"type of \`{obj}${file}{msg}'" \
|
||||
"${ext:+/ {obj2}${ext}{msg} }"\
|
||||
"(no extraction has been done).%f%b"
|
||||
+zinit-message "{info}[{pre}ziextract{info}]{error} Error:{msg} didn't recognize archive type of {obj}${file}{msg} ${ext:+/ {obj2}${ext}{msg} } (no extraction has been done).{rst}"
|
||||
}
|
||||
|
||||
if (( move | move2 )) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue