Skip to content

Commit

Permalink
Add satisfy-all-targets.
Browse files Browse the repository at this point in the history
  • Loading branch information
danfuzz committed Nov 30, 2023
1 parent e3d3089 commit 0d3cdcb
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions scripts/lib/bashy-basics/buildy-help.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,33 @@ done
# Library functions
#

# "Satisfies" all the given targets, printing out a final success-or-error
# report.
function satisfy-all-targets {
local targets=("$@")
local errors=0

local t
for t in "${targets[@]}"; do
satisfy-target "${t}" \
|| (( errors++ ))
done

info-msg

if (( ${errors} != 0 )); then
plural=''
if (( ${errors} != 1 )); then
plural='s'
fi
info-msg "${errors} error${plural}."
info-msg 'Alas.'
return 1
fi

info-msg 'No errors. Done!'
}

# "Satisfies" a given target. If it's already been built, does nothing other
# than returning the original result. If it _hasn't_ been built, attempts to
# build it by calling the corresponding `target-*` function.
Expand Down

0 comments on commit 0d3cdcb

Please sign in to comment.