removed tabs & added stderr redirections

This commit is contained in:
Emma Tebibyte 2022-11-27 02:53:19 -05:00
parent 44d2ac693a
commit 2089bd4079
1 changed files with 35 additions and 26 deletions

View File

@ -2,22 +2,30 @@
set -e
# check usage
if ! test -n "$1"; then
printf "Usage: %s [pattern...]\n" "$0" 2>&1
exit 64 # sysexits(3) EX_USAGE
fi
# check if we have tomcat(1)
if ! command -v tomcat >/dev/null 2>&1; then
printf "%s: Missing dependency: tomcat(1)\n"
printf "%s: Missing dependency: tomcat(1)\n" 2>&1
exit 69 # sysexits(3) EX_UNAVAILABLE
fi
dir="$(pwd | sed 's/\//\n/g' | tail -n 1)"
for toml in $(find "$PWD" -name "Cargo.toml"); do
printf "Project: %s\n" "$(tomcat package.name "$toml")"
toml_lic="$(tomcat package.license "$toml")"
if ! test -n "$toml_lic"; then
printf "%s: Missing license information\n" "$(printf "%s\n" "$toml" |\
sed "s/^.\+$dir\///g")"
continue 2
sed "s/^.\+$dir\///g")" 2>&1
continue
fi
for file in $(find "$(printf "%s\n" "$toml" |\
sed 's/Cargo\.toml/src/g')" -name "*.rs")
do
@ -26,13 +34,14 @@ for toml in $(find "$PWD" -name "Cargo.toml"); do
sed -n 's/\/\/ SPDX-License-Identifier: //p')" ]
then
printf "%s: Missing or malformed license information\n" \
"$(printf "%s\n" "$file" | sed "s/^.\+$dir\///g")"
"$(printf "%s\n" "$file" | sed "s/^.\+$dir\///g")" 2>&1
fi
if ! test -n "$(printf "%s\n" "$info" | head -n 1 |\
sed -n '/\/\/ Copyright (c) .\+/p')"
then
printf "%s: Missing or malformed copyright holder information\n" \
"$(printf "%s\n" "$file" | sed "s/^.\+$dir\///g")"
"$(printf "%s\n" "$file" | sed "s/^.\+$dir\///g")" 2>&1
fi
done
done