# This runs in a new shell DIR=${1} URL=${2} REV=${4} OPT=${5} MODULE=${DIR:t} CLEAR_LINE="\033[2K\r" if [[ -e ${DIR} ]]; then # Already exists return 0 fi [[ ${OPT} != -q ]] && print -n "${CLEAR_LINE}Installing ${MODULE} …" if ERR=$(command git clone -b ${REV} -q --recursive ${URL} ${DIR} 2>&1); then if [[ ${OPT} != -q ]]; then print -P "${CLEAR_LINE}%F{green}✓%f ${MODULE}: Installed" fi else print -P "${CLEAR_LINE}%F{red}✗ ${MODULE}: Error%f\n${ERR}" return 1 fi