aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xhaur15
1 files changed, 14 insertions, 1 deletions
diff --git a/haur b/haur
index 96c1564dc702..cb2613f30a18 100755
--- a/haur
+++ b/haur
@@ -133,6 +133,7 @@ else
fi
if [[ $CLEAR_CACHE == true ]]; then
+ REMOVED=false
if test -f "$HOME/.haur_cache"; then
echo "${blue}Clearing cache...${normal}"
while IFS= read -r line || [[ -n "$line" ]]; do
@@ -140,7 +141,19 @@ if [[ $CLEAR_CACHE == true ]]; then
rm -rf "$HOME/.haur/$line"
done < "$HOME/.haur_cache"
rm ~/.haur_cache
- else
+ REMOVED=true
+ fi
+
+ dirs=()
+ while IFS= read -r -d '' dir; do
+ dirs+=($(basename "${dir#*/}"))
+ done < <(find ~/.haur -maxdepth 1 -mindepth 1 -type d -print0)
+
+ for DIRECTORY in "${dirs[@]}"; do
+ pacman -Q $DIRECTORY &>/dev/null || echo "${blue}Removing $DIRECTORY${normal}" && rm -rf "$HOME/.haur/$DIRECTORY" && REMOVED=true
+ done
+
+ if [[ $REMOVED == false ]]; then
echo "${blue}Nothing to clear${normal}"
fi
fi \ No newline at end of file