Created
March 28, 2023 10:58
-
-
Save kitzberger/d8e6a775022fe5e2d4b3cd772a7edda8 to your computer and use it in GitHub Desktop.
Scan for LLL keys that are not being directly accessed (anymore)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Scan for LLL keys that are not being directly accessed (anymore) | |
# Called like this: t3-lll-scan packages/my_ext/*.xlf | |
t3-lll-scan() { | |
files=$(git ls-files $1) | |
for file in $files | |
do | |
echo "Processing file: $file" | |
labels=$(sed -n -e 's/^\s\+<trans-unit id="\([^"]\+\)".\+$/\1/p' $file) | |
for label in $labels | |
do | |
# -q => be quiet! | |
# -- '"!*.xlf' => ignore xlf files! | |
git grep -q "$label" -- ':!*.xlf' | |
if [ $? -gt 0 ]; then | |
echo "- No usage of label: $label" | |
fi | |
done | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment