diff --git a/bin/omakub-sub/uninstall.sh b/bin/omakub-sub/uninstall.sh index 34e997965..cec250b33 100644 --- a/bin/omakub-sub/uninstall.sh +++ b/bin/omakub-sub/uninstall.sh @@ -1,6 +1,16 @@ -#!/bin/bash +UNINSTALLER_LIST=() +while IFS= read -r path; do + UNINSTALLER_LIST+=("$(basename "$path" | sed 's/\.sh$//')") +done < <(find "$OMAKUB_PATH/uninstall" -mindepth 1 -maxdepth 1 -type f | sort) + +CHOICE=$(gum choose "${UNINSTALLER_LIST[@]}" "<< Back" --header "Uninstall application" --height "$((${#UNINSTALLER_LIST[@]} + 2))") + +if [[ "$CHOICE" == "<< Back"* ]] || [[ -z "$CHOICE" ]]; then + # Don't uninstall anything + echo "" +else + [ -n "$CHOICE" ] && gum confirm "Run uninstaller?" && source "$CHOICE" && gum spin --spinner globe --title "Uninstall completed!" -- sleep 3 +fi -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 clear -source $OMAKUB_PATH/bin/omakub +source $OMAKUB_PATH/bin/omakub \ No newline at end of file