1
0
Fork 0
mirror of synced 2024-06-18 06:41:08 -04:00
zimfw/src/stage2/28_zimfw_mv.zsh.erb
Eric Nielsen 8724686e85
Don't depend on cmp and xargs
as they requires busybox or diffutils and findutils.
Use `cksum` and `zargs` instead.

Fixes #393
2020-05-16 20:22:22 -05:00

13 lines
430 B
Plaintext

_zimfw_mv() {
local -a cklines=(${(f)"$(command cksum ${@})"})
if [[ ${${(z)cklines[1]}[1,2]} == ${${(z)cklines[2]}[1,2]} ]]; then
_zimfw_print -PR "<%= okay %>%B${2}:%b Already up to date"
else
if [[ -e ${2} ]]; then
command mv -f ${2}{,.old} || return 1
fi
command mv -f ${1} ${2} && \
_zimfw_print -PR "<%= okay %>%B${2}:%b Updated. Restart your terminal for changes to take effect."
fi
}