Skip to content

Instantly share code, notes, and snippets.

@kitzberger
Created March 28, 2023 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kitzberger/d8e6a775022fe5e2d4b3cd772a7edda8 to your computer and use it in GitHub Desktop.
Save kitzberger/d8e6a775022fe5e2d4b3cd772a7edda8 to your computer and use it in GitHub Desktop.
Scan for LLL keys that are not being directly accessed (anymore)
# 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