so the normal output is focused on the given action, and output for additional steps perfomed after the given action is only shown in verbose mode. Also, the output of wget is only shown in verbose mode. This is because wget always shows some output (to stderr) even when there are no errors. See https://serverfault.com/q/70889/302338 This should give a friendlier output. See #360
20 lines
618 B
Text
20 lines
618 B
Text
# 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
|
|
(( 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 )); 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
|