903e0e5249
actions. Return 4 if there's a zimfw update from check-version. Don't return a specific error code if there are module updates from check, as it uses zargs to check all and each check runs in a separate shell. Need to figure out how to propagate all that to a final error code. See #503
17 lines
745 B
Plaintext
17 lines
745 B
Plaintext
_zimfw_check_version() {
|
|
if [[ ${1} -ne 0 ]]; then
|
|
# Get latest version (get all `v*` tags from repo, delete `*v` from beginning,
|
|
# sort in descending `O`rder `n`umerically, and get the `[1]` first)
|
|
local tags
|
|
tags=$(command git ls-remote --tags --refs https://github.com/zimfw/zimfw.git 'v*') || return 1
|
|
>! ${_zversion_target} <<<${${(On)${(f)tags}##*v}[1]} || return 1
|
|
fi
|
|
local -r zlatest_version=$(<${_zversion_target})
|
|
if [[ -n ${zlatest_version} && ${_zversion} != ${zlatest_version} ]]; then
|
|
if (( _zprintlevel > 0 )); then
|
|
print -u2 -PR "%F{yellow}Latest zimfw version is %B${zlatest_version}%b. You're using version %B${_zversion}%b. Run %Bzimfw upgrade%b to upgrade.%f"
|
|
fi
|
|
return 4
|
|
fi
|
|
}
|