add orphan package reporting

This commit is contained in:
Ray Elliott 2025-09-13 11:52:41 +01:00
parent 20d4cd4d1f
commit ac38a9302e
1 changed files with 27 additions and 6 deletions

33
bashrc
View File

@ -142,14 +142,35 @@ if [ ${_mem_available%.*} -lt 5 ] ; then
fi
if [ $_updates_available -gt 0 ] ; then
echo -ne "Updates available: \033[1;37m"
[ $_updates_available -gt 15 ] && echo -ne "\033[0;33m"
[ $_updates_available -gt 29 ] && echo -ne "\033[0;31m"
echo -ne "$_updates_available\033[0m"
echo -ne " [ update with: \033[1;31mupdate\033[0m ]"
echo ""
update_color="\033[1;37m" # default white
if [ $_updates_available -gt 29 ] ; then
update_color="\033[0;31m" # red
elif [ $_updates_available -gt 15 ] ; then
update_color="\033[0;33m" # yellow
fi
echo -ne "Updates available: ${update_color}${_updates_available}\033[0m"
echo -ne " [ update with: ${update_color}update\033[0m ]"
echo ""
fi
_orphans_available="$(pacman -Qdtq 2>/dev/null | wc -l)"
if [ $_orphans_available -gt 0 ] ; then
echo -ne "Orphaned packages: \033[1;37m"
orphan_color="\033[1;37m"
if [ $_orphans_available -gt 9 ] ; then
orphan_color="\033[0;31m"
elif [ $_orphans_available -gt 4 ] ; then
orphan_color="\033[0;33m"
fi
echo -ne "${orphan_color}${_orphans_available}\033[0m"
echo -ne " [ remove with: ${orphan_color}sudo pacman -Rns \$(pacman -Qdtq)\033[0m ]"
echo ""
fi
echo ""
echo -e "Remember \"\033[1;34mTODO.md\033[0m\" and \"\033[1;34mautonote.md\033[0m\" files have content automatically displayed."
echo -e "Edit these with \033[1;34met\033[0m and \033[1;34mea\033[0m"