TheRepoClub-DotFiles/localbin/.local/bin/pc

54 lines
1.3 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env bash
## Reset Colors
Reset='\e[0m'
### Custom colors
Purple='\e[1;35m'
Yellow='\e[1;33m'
Green='\e[1;32m'
Blue='\e[1;34m'
Cyan='\e[1;36m'
Red='\e[1;31m'
### Custom colors
declare -a repolist
col=0
###Function
function repo_list () {
repolist=($(pacman-conf -l))
for i in "${repolist[@]}"; do
count=$(paclist $i | wc -l)
col=$((col+1))
printf "\e[0;3${col}m\e[1m %s \e[0m%d\n" "$i" "$count"
done
}
function package_count () {
printf "${Red} Explicit${Reset}: %s\n" "$(pacman -Qe | wc -l)"
printf "${Green} Total${Reset}: %s\n" "$(pacman -Q | wc -l)"
if [ "$(pacman -Qqm | wc -l)" -gt "0" ]; then
printf "${Blue} AUR${Reset}: %s\n" "$(pacman -Qm | wc -l)"
fi
if command -v basher &> /dev/null; then
num=0
while read -r ; do
num=$(( num + 1))
done <<< $( basher list )
if [ "$num" -gt "0" ]; then
printf "${Yellow} Basher${Reset}: %s\n" "${num}"
fi
fi
if command -v pip &> /dev/null; then
num=0
while read -r ; do
num=$(( num + 1))
done <<< $( pip list )
if [ "$num" -gt "0" ]; then
printf "${Cyan} PIP${Reset}: %s\n" "${num}"
fi
fi
echo
repo_list
return
}
package_count