cffd456556
and rename previous to git. Tools allow for different install and update scripts. The git tool does what the previous implementation did (installs and updates using the git client). The new tool installs and updates with the GitHub API, not using the git client, but using curl/wget and tar instead. Closes #373
20 lines
959 B
Plaintext
20 lines
959 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 [[ -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 ${${(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 -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
|
|
fi
|
|
}
|