Skip to content

Commit ad88a89

Browse files
committed
fix: gh-r & bpick ice log format and content
Signed-off-by: Vladislav Doster <[email protected]>
1 parent 599859b commit ad88a89

File tree

3 files changed

+17
-18
lines changed

3 files changed

+17
-18
lines changed

doc/zsdoc/zinit-install.zsh.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ ____
278278
package. Connects to Github releases page.
279279
____
280280
281-
Has 49 line(s). Calls functions:
281+
Has 48 line(s). Calls functions:
282282
283283
.zinit-get-latest-gh-r-url-part
284284
`-- zinit.zsh/+zinit-message
@@ -520,7 +520,7 @@ ziextract
520520
____
521521
522522
If the file is an archive, it is extracted by this function.
523-
Next stage is scanning of files with the common utility `file',
523+
Next stage is scanning of files with the common utility file
524524
to detect executables. They are given +x mode. There are also
525525
messages to the user on performed actions.
526526

zinit-autoload.zsh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,7 @@ ZINIT[EXTENDED_GLOB]=""
15021502
}
15031503
}
15041504
if (( ZINIT[annex-multi-flag:pull-active] <= 1 && !OPTS[opt_-q,--quiet] )) {
1505-
builtin print -- "\rBinary release already up to date (version: $version)"
1505+
+zinit-message "{info}[{pre}${ice[from]}{info}]{rst} latest version ({version}${version}{rst}) already installed"
15061506
}
15071507
}
15081508

zinit-install.zsh

+14-15
Original file line numberDiff line numberDiff line change
@@ -1544,47 +1544,46 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
15441544
tag_version="$( { .zinit-download-file-stdout $releases_url || .zinit-download-file-stdout $releases_url 1; } 2>/dev/null | command grep -m1 -o 'href=./'$user'/'$plugin'/releases/tag/[^"]\+' )"
15451545
tag_version=${tag_version##*/}
15461546
fi
1547-
local url=https://github.com/$user/$plugin/releases/expanded_assets/$tag_version else
1547+
local url=https://github.com/$user/$plugin/releases/expanded_assets/$tag_version
1548+
else
15481549
local url=https://$urlpart
15491550
fi
15501551
init_list=( ${(@f)"$( { .zinit-download-file-stdout $url || .zinit-download-file-stdout $url 1; } 2>/dev/null | command grep -o 'href=./'$user'/'$plugin'/releases/download/[^"]\+')"} )
15511552
init_list=(${init_list[@]#href=?})
15521553
bpicks=(${(s.;.)ICE[bpick]})
15531554
[[ -z $bpicks ]] && bpicks=("")
1554-
local bpick bpick_error
1555+
local bpick bpick_error=""
15551556
reply=()
15561557
for bpick in "${bpicks[@]}"; do
15571558
list=($init_list)
1558-
if [[ -n $bpick ]] {
1559+
if [[ -n $bpick ]]; then
15591560
list=( ${(M)list[@]:#(#i)*/$~bpick} )
1560-
bpick_error="{nl}{info}[{pre}gh-r{info}]{rst} To fix, modify {ice}bpick{rst} ice value {glob}${bpick}"
1561-
}
1561+
if (( !$#list )); then
1562+
+zinit-message "{info}[{pre}gh-r{info}] {error}Error{rst}: {ice}bpick{rst} ice found no release assets{rst}. To fix, modify the {ice}bpick{rst} glob pattern {glob}${bpick}{rst}"
1563+
fi
1564+
fi
15621565

15631566
local junk="([3-6]86|md5|sig|asc|txt|vsix|sum|sha256*|pkg|.(apk|deb|json|rpm|sh(#e)))"
15641567
filtered=( ${list[@]:#(#i)*${~junk}*} ) && (( $#filtered > 0 )) && list=( ${filtered[@]} )
15651568

15661569
for part in "${parts[@]}"; do
1567-
if (( $#list > 1 )) {
1568-
filtered=( ${(M)list[@]:#(#i)*${~part}*} ) && (( $#filtered > 0 )) && list=( ${filtered[@]} )
1569-
# +zinit-message "{info}[{pre}gh-r{info}]{rst} filter -> {glob}${part}{rst}{nl} - ${(@pj:\n - :)list[1,2]}{nl}"
1570-
}
1570+
if (( $#list > 1 )) { filtered=( ${(M)list[@]:#(#i)*${~part}*} ) && (( $#filtered > 0 )) && list=( ${filtered[@]} ) }
1571+
# +zinit-message "{info}[{pre}gh-r{info}]{rst} filter -> {glob}${part}{rst}{nl} - ${(@pj:\n - :)list[1,2]}{nl}"
15711572
done
15721573

1573-
if (( $#list > 1 )); then
1574-
filtered=( ${list[@]:#(#i)*.(sha[[:digit:]]#|asc)} ) && (( $#filtered > 0 )) && list=( ${filtered[@]} )
1575-
fi
1574+
if (( $#list > 1 )) { filtered=( ${list[@]:#(#i)*.(sha[[:digit:]]#|asc)} ) && (( $#filtered > 0 )) && list=( ${filtered[@]} ); }
15761575

15771576
if (( !$#list )); then
1578-
+zinit-message -n "{info}[{pre}gh-r{info}]{error} No GitHub release asset to download ${bpick_error}{rst}"
1577+
+zinit-message "{nl}{info}[{pre}gh-r{info}] {error}Error{rst}: No GitHub release assets found for {glob}${tag_version}{rst}"
15791578
return 1
15801579
fi
1581-
reply+=($list[1])
1580+
reply+=( "${list[1]}" )
15821581
done
15831582
[[ -n $reply ]]
15841583
} # ]]]
15851584
# FUNCTION: ziextract [[[
15861585
# If the file is an archive, it is extracted by this function.
1587-
# Next stage is scanning of files with the common utility `file',
1586+
# Next stage is scanning of files with the common utility file
15881587
# to detect executables. They are given +x mode. There are also
15891588
# messages to the user on performed actions.
15901589
#

0 commit comments

Comments
 (0)