From 5f3e9a5ededd5fd3fbec59411a98bd282e51216f Mon Sep 17 00:00:00 2001 From: excalibur1234 Date: Tue, 24 Jul 2018 17:22:41 +0200 Subject: [PATCH] add yay -Yc --- pacui | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/pacui b/pacui index 69a9855..4a214a4 100644 --- a/pacui +++ b/pacui @@ -288,21 +288,27 @@ function func_m echo " searching orphans ..." - if [[ -n "$(pacman -Qdt)" ]] # only run the following commands, if output of "pacman -Qdt" is not empty. + if [[ "$AUR_Helper" == "yay" ]] then - pacman -Qdt --color always # display orphaned packages - # ask, whether to remove the displayed orphaned packages: - echo -e " \e[41m Do you want to remove these orphaned packages? [Y|n] \e[0m" - read -rs -n1 answer # save user input in "answer" variable (only accept 1 character as input) - - case ${answer:-y} in # if ENTER is pressed, the variable "answer" is empty. if "answer" is empty, its default value is "y". - y|Y|yes|YES|Yes ) # do this, if "answer" is y or Y or yes or YES or Yes - sudo pacman -Rsn $(pacman -Qqdt) --color always --noconfirm # ATTENTION: (i do not know why but) using quotes (" symbols) around $(...) breaks pacman command for multiple packages - ;; - * ) # do this in all other cases - echo -e " \e[1m Packages have not been removed.\e[0m" - ;; - esac # end of "case" loop + yay -Yc # do orphan cleaning and yay cleaning + + else # do this for all other AUR helpers: + if [[ -n "$(pacman -Qdt)" ]] # only run the following commands, if output of "pacman -Qdt" is not empty. + then + pacman -Qdt --color always # display orphaned packages + # ask, whether to remove the displayed orphaned packages: + echo -e " \e[41m Do you want to remove these orphaned packages? [Y|n] \e[0m" + read -rs -n1 answer # save user input in "answer" variable (only accept 1 character as input) + + case ${answer:-y} in # if ENTER is pressed, the variable "answer" is empty. if "answer" is empty, its default value is "y". + y|Y|yes|YES|Yes ) # do this, if "answer" is y or Y or yes or YES or Yes + sudo pacman -Rsn $(pacman -Qqdt) --color always --noconfirm # ATTENTION: (i do not know why but) using quotes (" symbols) around $(...) breaks pacman command for multiple packages + ;; + * ) # do this in all other cases + echo -e " \e[1m Packages have not been removed.\e[0m" + ;; + esac # end of "case" loop + fi fi echo ""