Skip to content

Commit

Permalink
add yay -Yc
Browse files Browse the repository at this point in the history
  • Loading branch information
excalibur1234 committed Jul 24, 2018
1 parent 2246dcd commit 5f3e9a5
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions pacui
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""

Expand Down

0 comments on commit 5f3e9a5

Please sign in to comment.