From 1bb9374445773196a85fb0faf14622e443ad21f1 Mon Sep 17 00:00:00 2001
From: roman
Date: Thu, 13 Feb 2025 12:01:40 -0500
Subject: [PATCH 1/2] Replacing to loop and adding focus
1. Although the previous solution worked, surrounding with while for
readability.
2. Focus ( if that's the name ) :
- First, reading the exsiting size value from the .toml
- Then, on load, the focus will be on the configured font size, rather
than on the first item. Changing font size will keep the focus on the
new value.
* Inside the while, in the first run, the sed will rewrite the existing
value; the other approach is to move this line below the choise
selection, but then, there's a need to first check that in case of
"<
Date: Thu, 13 Feb 2025 20:00:05 -0500
Subject: [PATCH 2/2] Sorted, bigger and with back button
1. Getting all apps from $OMAKUB_PATH/uninstall, removing path and app-
prefix if exists, also, removing the .sh postfix, sorting and adding the
"<< Back" option at the end.
2. Add header "Uninstall application" ( similar to the one in install.sh
), set height to 29 ( to see all items ).
3. Going back to $OMAKUB_PATH/uninstall to fetch the full path to the
.sh app.
4. reusing the exisintg gum confirm logic.
* if user is pressing Back or ctrl+c, it will bring him to previous
menu.
---
bin/omakub-sub/uninstall.sh | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/bin/omakub-sub/uninstall.sh b/bin/omakub-sub/uninstall.sh
index 357449351..cd96dfa36 100644
--- a/bin/omakub-sub/uninstall.sh
+++ b/bin/omakub-sub/uninstall.sh
@@ -1,4 +1,9 @@
-UNINSTALLER=$(gum file $OMAKUB_PATH/uninstall --height 26)
-[ -n "$UNINSTALLER" ] && gum confirm "Run uninstaller?" && source $UNINSTALLER && gum spin --spinner globe --title "Uninstall completed!" -- sleep 3
+CHOICES=($(find $OMAKUB_PATH/uninstall -type f -exec basename {} \; | sed 's/app-//;s/\.sh$//' | sort))
+CHOICES+=("<< Back")
+
+choice=$(gum choose "${CHOICES[@]}" --height 29 --header "Uninstall application")
+app_user_wishes_to_uninstall=$(find $OMAKUB_PATH/uninstall -type f -name *"$choice".sh)
+
+[ -n "$app_user_wishes_to_uninstall" ] && gum confirm "Run uninstaller for $choice?" && source $app_user_wishes_to_uninstall && gum spin --spinner globe --title "Uninstall completed!" -- sleep 3
clear
source $OMAKUB_PATH/bin/omakub