b3c7fde730
See http://zsh.sourceforge.net/Doc/Release/Shell-Grammar.html#Alternate-Forms-For-Complex-Commands
19 lines
603 B
Plaintext
19 lines
603 B
Plaintext
# This runs in a new shell
|
|
readonly MODULE=${1}
|
|
readonly DIR=${2}
|
|
readonly URL=${3}
|
|
readonly REV=${5}
|
|
readonly -i PRINTLEVEL=${6}
|
|
readonly CLEAR_LINE=$'\E[2K\r'
|
|
if [[ -e ${DIR} ]]; then
|
|
# Already exists
|
|
return 0
|
|
fi
|
|
if (( PRINTLEVEL > 0 )) print -Rn ${CLEAR_LINE}"Installing ${MODULE}<%= ellipsis %>"
|
|
if ERR=$(command git clone -b ${REV} -q --recursive ${URL} ${DIR} 2>&1); then
|
|
if (( PRINTLEVEL > 0 )) print -PR ${CLEAR_LINE}"<%= okay %>%B${MODULE}:%b Installed"
|
|
else
|
|
print -u2 -PR ${CLEAR_LINE}"%F{red}<%= error %>%B${MODULE}:%b Error during git clone%f"$'\n'${(F):- ${(f)^ERR}}
|
|
return 1
|
|
fi
|