Add paccompare() shell function

This commit is contained in:
2024-08-21 13:29:02 +02:00
parent 2bb01a3bf5
commit 278063eb53

View File

@@ -321,3 +321,26 @@ weather(){
} }
# For cleaning up aur helper cache
paccompare(){
installed_packages=($(pacman -Q | cut -d' ' -f1))
current_dir_contents=(*)
is_package() {
local dir="$1"
for package in "${installed_packages[@]}"; do
if [[ "$dir" == "$package" ]]; then
return 0
fi
done
return 1
}
for dir in "${current_dir_contents[@]}"; do
if [[ -d "$dir" ]] && ! is_package "$dir"; then
echo "$dir"
fi
done
}