-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
75b6519
commit 5164dfd
Showing
13 changed files
with
52 additions
and
20 deletions.
There are no files selected for viewing
Binary file removed
BIN
-23.8 KB
...erences/workflows/alfred-docs-searches/98AAE9F9-5186-4AFC-9B57-4FAE561C05AE.png
Binary file not shown.
Binary file removed
BIN
-23.8 KB
...erences/workflows/alfred-docs-searches/B884F61F-1B79-4D70-9CFB-57C3E87E26D9.png
Binary file not shown.
Binary file removed
BIN
-8.2 KB
...s/workflows/alfred-japanese-dictionary/A0E14CF3-0C63-45A4-9D9C-DB141BF07B2D.png
Binary file not shown.
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
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
Binary file added
BIN
+912 KB
Alfred.alfredpreferences/workflows/alfred-workflow-devtools/Alfred.icns
Binary file not shown.
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
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
54 changes: 42 additions & 12 deletions
54
Alfred.alfredpreferences/workflows/alfred-workflow-devtools/scripts/unused-files.sh
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,56 @@ | ||
#!/usr/bin/env zsh | ||
# shellcheck disable=2030,2031 # apparently still works, cause it's zsh? | ||
#─────────────────────────────────────────────────────────────────────────────── | ||
|
||
# FILES IN WORKFLOW FOLDER | ||
current_workflow_path="$(echo "$*" | tr -d '\n')" | ||
cd "$current_workflow_path" || return 1 | ||
|
||
echo "### $(basename "$current_workflow_path")" # for displaying in Alfred | ||
|
||
#─────────────────────────────────────────────────────────────────────────────── | ||
|
||
# FILES IN WORKFLOW FOLDER | ||
notfound_files="" | ||
files=$(find . -type f \ | ||
-not -name "*.png" -not -name "*.plist" -not -name "*.d.ts" -not -name "*.md" \ | ||
-not -path "./.git*" -not -name ".*" | | ||
cut -c3-) | ||
|
||
# CHECK IF USED IN `info.plist` | ||
# (only checking the `info.plist` still finds files which may be used by other scripts) | ||
notfound="" | ||
# CHECK IF USED IN WORKFLOW | ||
echo "$files" | while read -r file; do | ||
grep -q "$file" ./**/* || notfound="$notfound- $file\n" | ||
grep -q "$file" ./**/* || notfound_files="$notfound_files- $file\n" | ||
done | ||
|
||
#─────────────────────────────────────────────────────────────────────────────── | ||
|
||
# UID-PNG FILES | ||
uid_pngs=$(find . -type f -name "????????-????-????-????-????????????.png" -print0 | | ||
xargs -0 -I {} basename {} ".png") | ||
|
||
# CHECK IF USED IN `info.plist` | ||
deleted_uid_pngs="" | ||
echo "$uid_pngs" | while read -r uid; do | ||
if ! grep -q "$uid" ./info.plist ; then | ||
deleted_uid_pngs="$deleted_uid_pngs- $uid.png\n" | ||
rm "./$uid.png" | ||
fi | ||
done | ||
info=$([[ -z "$notfound" ]] && | ||
echo "✅ No unused files found for this workflow." || | ||
echo "⚠️ There are files not referenced in any of this workflow's files. This does not not necessary mean that they are unused, but it indicates that they might be unused.") | ||
|
||
#─────────────────────────────────────────────────────────────────────────────── | ||
|
||
# DISPLAY IN ALFRED | ||
echo "### $(basename "$current_workflow_path")" | ||
echo "$info" | ||
echo "$notfound" | ||
if [[ -z "$notfound_files" && -z "$deleted_uid_pngs" ]]; then | ||
echo "✅ No unused files found for this workflow." | ||
exit 0 | ||
fi | ||
|
||
if [[ -n "$notfound_files" ]]; then | ||
echo "⚠️ There are files not referenced in any of this workflow's files." | ||
echo "(This does not necessarily mean that they are unused, but is only an indicator.)" | ||
echo "$notfound_files" | ||
echo | ||
fi | ||
if [[ -n "$deleted_uid_pngs" ]]; then | ||
echo "ℹ️ The following UID-PNG are not referenced in this workflow's \`info.plist\` and have been deleted." | ||
echo "$deleted_uid_pngs" | ||
fi | ||
|
Binary file removed
BIN
-34.9 KB
...edpreferences/workflows/misc-utilities/1ED11A83-B032-49DD-A27E-82281010DEC8.png
Binary file not shown.
Binary file removed
BIN
-30.2 KB
...edpreferences/workflows/misc-utilities/BC1490BF-6C58-406A-847F-DB89AF6AEB8E.png
Binary file not shown.
Binary file removed
BIN
-20.1 KB
...edpreferences/workflows/misc-utilities/C0D78CFC-A2DC-4523-B3B6-8D18C8DE5707.png
Binary file not shown.
Binary file removed
BIN
-65.2 KB
...edpreferences/workflows/misc-utilities/E0DF7030-2943-416D-BF96-8594A9D6B8D1.png
Binary file not shown.