;dev:tools:checkembeddedfiles: fail when rg is not installed

This commit is contained in:
Simon Michael 2023-06-02 11:08:40 -10:00
parent a6d3424e0b
commit 7bbda90e2c

View File

@ -2,11 +2,15 @@
# Check that all files embedded with file-embed are declared in extra-source-files
set -e
rg="rg --sort=path"
$rg --version >/dev/null
echo "Checking embedded file declarations:"
mapfile -t embeddedfiles < <(rg --sort=path '^ +\$\(embedFileRelative "([^"]+)"' -or '$1' -I)
# shellcheck disable=SC2016
mapfile -t embeddedfiles < <($rg -I '^ +\$\(embedFileRelative "([^"]+)"' -or '$1')
status=0
for f in "${embeddedfiles[@]}"; do
if output=$(rg --sort=path -l "$f" -- */package.yaml); then
if output=$($rg -l "$f" -- */package.yaml); then
printf '%-40s\tdeclared in %s\n' "$f" "$output"
else
printf '%-40s\tUNDECLARED\n' "$f"