Skip to content

Commit

Permalink
Add styling to differentiate each steps of the main script more easily (
Browse files Browse the repository at this point in the history
#55)

* Add styling to differentiate each 'update' steps more easily

This PR aims to add some basic styling to differentiate each `update` steps (regular packages, AUR packages, Flatpak packages) more easily.
This makes the script more "transparent" about what it does and will also be useful for eventual debugging.

* Add style for orphan/unused removal as well

* Add correct spacing

* Styling

* Add style for pacnew processing
  • Loading branch information
Antiz96 authored Nov 10, 2023
1 parent d1286e7 commit 7a45dfa
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/script/arch-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ list_news() {
echo -e "\n---\nTitle: ${news_selected}\nAuthor: ${news_author}\nPublication date: ${news_date}\nURL: ${news_url}\n---\n\n${news_article}\n" && read -n 1 -r -s -p $'Press \"enter\" to continue\n'
;;
*)
echo
redo="n"
;;
esac
Expand All @@ -176,6 +175,7 @@ update() {
list_news

if [ -n "${packages}" ]; then
echo -e "\n--Updating Packages--"
if ! "${su_cmd}" pacman -Syu; then
icon_updates_available
echo -e >&2 "\nAn error has occurred\nThe update has been aborted\n" && read -n 1 -r -s -p $'Press \"enter\" to quit\n'
Expand All @@ -184,6 +184,7 @@ update() {
fi

if [ -n "${aur_packages}" ]; then
echo -e "\n--Updating AUR Packages--"
if ! "${aur_helper}" -Syu; then
icon_updates_available
echo -e >&2 "\nAn error has occurred\nThe update has been aborted\n" && read -n 1 -r -s -p $'Press \"enter\" to quit\n'
Expand All @@ -192,6 +193,7 @@ update() {
fi

if [ -n "${flatpak_packages}" ]; then
echo -e "\n--Updating Flatpak Packages--"
if ! flatpak update; then
icon_updates_available
echo -e >&2 "\nAn error has occurred\nThe update has been aborted\n" && read -n 1 -r -s -p $'Press \"enter\" to quit\n'
Expand Down Expand Up @@ -225,7 +227,7 @@ orphan_packages() {

case "${answer}" in
[Yy])
echo
echo -e "\n--Removing Orphan Packages--"
pacman -Qtdq | "${su_cmd}" pacman -Rns - && echo -e "\nThe removal has been applied\n" || echo -e >&2 "\nAn error has occurred\nThe removal has been aborted\n"
;;
*)
Expand All @@ -247,7 +249,7 @@ orphan_packages() {

case "${answer}" in
[Yy])
echo
echo -e "\n--Removing Flatpak Unused Packages--"
flatpak remove --unused && echo -e "\nThe removal has been applied\n" || echo -e >&2 "\nAn error has occurred\nThe removal has been aborted\n"
;;
*)
Expand All @@ -274,7 +276,7 @@ pacnew_files() {

case "${answer}" in
[Yy]|"")
echo
echo -e "\n--Processing Pacnew Files--"
"${su_cmd}" pacdiff
echo -e "\nThe pacnew file(s) processing has been applied\n"
;;
Expand Down

0 comments on commit 7a45dfa

Please sign in to comment.