stagefiles: only list missing stages

This commit is contained in:
Lyndon Brown 2020-03-14 04:37:56 +00:00
parent 3bed138fda
commit fe0d2358b9
1 changed files with 10 additions and 6 deletions

View File

@ -72,20 +72,24 @@ Require_stagefile ()
fi
local FILE
local MISSING=false
local MISSING=""
local MISSING_MULTIPLE=false
for FILE in ${@}; do
if [ ! -f ".build/${FILE}" ]; then
MISSING=true
if [ -n "${MISSING}" ]; then
MISSING_MULTIPLE=true
fi
MISSING="${MISSING:+$MISSING }${FILE}"
fi
done
if ! $MISSING; then
if [ -z "${MISSING}" ]; then
return 0
fi
if [ $# -eq 1 ]; then
Echo_error "the following stage is required to be completed first: %s" "${FILE}"
if ! $MISSING_MULTIPLE; then
Echo_error "the following stage is required to be done first: %s" "${MISSING}"
else
Echo_error "the following stages are required to be completed first: %s" "$(echo ${@})"
Echo_error "the following stages are required to be completed first: %s" "${MISSING}"
fi
exit 1