Add paccompare() shell function
This commit is contained in:
23
.functions
23
.functions
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user