887bfd6a03
Show the value of some relevant environment variables instead of calling uname, which might show private information like the host name. Other minor fixes regarding output.
19 lines
922 B
Plaintext
19 lines
922 B
Plaintext
_zimfw_version_check() {
|
|
if (( _zprintlevel > 0 )); then
|
|
local -r ztarget=${ZIM_HOME}/.latest_version
|
|
# If .latest_version does not exist or was not modified in the last 30 days
|
|
if [[ -w ${ztarget:h} && ! -f ${ztarget}(#qNm-30) ]]; 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)
|
|
print -R ${${(On)${(f)"$(command git ls-remote --tags --refs \
|
|
https://github.com/zimfw/zimfw.git 'v*' 2>/dev/null)"}##*v}[1]} >! ${ztarget} &!
|
|
fi
|
|
if [[ -f ${ztarget} ]]; then
|
|
local -r zlatest_version=$(<${ztarget})
|
|
if [[ -n ${zlatest_version} && ${_zversion} != ${zlatest_version} ]]; then
|
|
print -u2 -PlR "%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
|
|
fi
|
|
fi
|
|
}
|