From ac38a9302e466cde54224c7bd9af9785d6771a7c Mon Sep 17 00:00:00 2001 From: ray Date: Sat, 13 Sep 2025 11:52:41 +0100 Subject: [PATCH] add orphan package reporting --- bashrc | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/bashrc b/bashrc index ddaed5f..73b1086 100644 --- a/bashrc +++ b/bashrc @@ -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"