to autoloads the functions and sources the scripts, instead of executing zimfw during startup, and having it always figuring out what do to on the fly. This takes out the worry about zimfw interfering with the startup time, and allows room to add more features to it. So, zstyle was replaced by a custom zmodule function to define the modules, with the extra ability of allowing users to set custom fpath paths, autoloaded functions and sourced scripts per module.
27 lines
927 B
Plaintext
27 lines
927 B
Plaintext
_zimfw_upgrade() {
|
|
local -r zscript=${ZIM_HOME}/<%= script_filename %>
|
|
local -r zurl=https://raw.githubusercontent.com/zimfw/zimfw/develop/<%= script_filename %>
|
|
{
|
|
if (( ${+commands[wget]} )); then
|
|
command wget -nv ${1} -O ${zscript}.new ${zurl} || return 1
|
|
else
|
|
command curl -fsSL -o ${zscript}.new ${zurl} || return 1
|
|
fi
|
|
if command cmp -s ${zscript}{,.new}; then
|
|
if (( ! _zquiet )); then
|
|
print -P '%F{green}✓%f %B<%= script_filename %>:%b Already up to date'
|
|
fi
|
|
else
|
|
command mv -f ${zscript}{,.old} && command mv -f ${zscript}{.new,} && \
|
|
if (( ! _zquiet )); then
|
|
print -P '%F{green}✓%f %B<%= script_filename %>:%b Upgraded. Restart your terminal for changes to take effect.'
|
|
fi
|
|
fi
|
|
if (( ! _zquiet )); then
|
|
print -P '%F{green}✓%f Done with upgrade.'
|
|
fi
|
|
} always {
|
|
command rm -f ${zscript}.new
|
|
}
|
|
}
|