zimfw/src/stage2/50_zimfw_upgrade.zsh.erb

20 lines
686 B
Plaintext

_zimfw_upgrade() {
local -r ztarget=${ZIM_HOME}/zimfw.zsh
local -r zurl=https://raw.githubusercontent.com/zimfw/zimfw/master/zimfw.zsh
{
if (( ${+commands[wget]} )); then
local zopt
(( _zprintlevel <= 1 )) && zopt='-q'
if ! command wget -nv ${zopt} -O ${ztarget}.new ${zurl}; then
(( _zprintlevel <= 1 )) && print -u2 -PR "%F{red}<%= error %>Error downloading %B${zurl}%b. Use %B-v%b option to see details.%f"
return 1
fi
else
command curl -fsSL -o ${ztarget}.new ${zurl} || return 1
fi
_zimfw_mv ${ztarget}{.new,} && _zimfw_print -P '<%= done %>Done with upgrade.'
} always {
command rm -f ${ztarget}.new
}
}