1
0
Fork 0
mirror of synced 2024-06-01 23:01:11 -04:00
zimfw/src/tools/install.zsh.erb
Eric Nielsen 93bbc35634
Use ASCII characters only
we want to be a universal Zsh framework, and send the message that
"less is less"!  ;- )

Don't indent done and failed messages with an indicator, at the end of
actions, to differentiate them from intermediate okay and error messages.
2020-01-02 12:58:03 -05:00

21 lines
599 B
Plaintext

# This runs in a new shell
readonly MODULE=${1}
readonly DIR=${2}
readonly URL=${3}
readonly REV=${5}
readonly -i QUIET=${6}
readonly CLEAR_LINE=$'\E[2K\r'
if [[ -e ${DIR} ]]; then
# Already exists
return 0
fi
(( ! QUIET )) && print -Rn ${CLEAR_LINE}"Installing ${MODULE}<%= ellipsis %>"
if ERR=$(command git clone -b ${REV} -q --recursive ${URL} ${DIR} 2>&1); then
if (( ! QUIET )); then
print -PR ${CLEAR_LINE}"<%= okay %>%B${MODULE}:%b Installed"
fi
else
print -u2 -PR ${CLEAR_LINE}"%F{red}<%= error %>%B${MODULE}:%b Error during git clone%f"$'\n'${(F):- ${(f)^ERR}}
return 1
fi