zimfw/src/stage2/40_zimfw_version_check.zsh.erb

17 lines
783 B
Plaintext

_zimfw_version_check() {
if (( _zprintlevel > 0 )); then
setopt LOCAL_OPTIONS EXTENDED_GLOB
local -r ztarget=${ZIM_HOME}/.latest_version
# If .latest_version does not exist or was not modified in the last 30 days
if [[ ! -f ${ztarget}(#qNm-30) ]]; then
command git ls-remote --tags --refs https://github.com/zimfw/zimfw.git 'v*' | \
command sed 's?^.*/v??' | command sort -n -t. -k1,1 -k2,2 -k3,3 | \
command tail -n1 >! ${ztarget} &!
fi
local -r zlatest_version=$(<${ztarget})
if [[ -n ${zlatest_version} && ${_zversion} != ${zlatest_version} ]]; 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"$'\n'
fi
fi
}