aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-06-18 11:31:02 +0200
committerDanilo M. <danix@danix.xyz>2026-06-18 11:31:02 +0200
commitdcd151797c2777fcc061920207b17342b72420e4 (patch)
tree905074192e9e0943a69cc810ec4914f71df39070
parent0ee0d7aacf0e6501ef5813280518ab8143daf089 (diff)
downloadmkhintfile-dcd151797c2777fcc061920207b17342b72420e4.tar.gz
mkhintfile-dcd151797c2777fcc061920207b17342b72420e4.zip
refactor: extract _remove_hint helper for reuse in review loop
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
-rwxr-xr-xmkhint22
1 files changed, 14 insertions, 8 deletions
diff --git a/mkhint b/mkhint
index 7311ffe..38e758c 100755
--- a/mkhint
+++ b/mkhint
@@ -586,6 +586,19 @@ prompt_slackrepo() {
fi
}
+# Remove a hint file and its .bak if present. No existence guard, no exit —
+# safe to call inside loops. Echoes what was removed.
+_remove_hint() {
+ local full_path="$1"
+ rm "$full_path"
+ echo "Deleted: $full_path"
+ local bak_path="${full_path}.bak"
+ if [[ -f "$bak_path" ]]; then
+ rm "$bak_path"
+ echo "Deleted: $bak_path"
+ fi
+}
+
# Delete a hint file (and .bak if present)
delete_hint_file() {
local file="$1"
@@ -602,14 +615,7 @@ delete_hint_file() {
exit 2
fi
- rm "$full_path"
- echo "Deleted: $full_path"
-
- local bak_path="${full_path}.bak"
- if [[ -f "$bak_path" ]]; then
- rm "$bak_path"
- echo "Deleted: $bak_path"
- fi
+ _remove_hint "$full_path"
}
# Clean .bak files from HINT_DIR