Actualiser toolbox

This commit is contained in:
Tyleo Dv. Delaware 2025-05-29 03:04:31 +02:00
parent 2765a509f5
commit 81fd8f1d07

16
toolbox
View file

@ -20,8 +20,14 @@ fi
# Prepare menu options
MENU_OPTIONS=()
declare -A SCRIPT_MAP
for script in "${SCRIPTS[@]}"; do
MENU_OPTIONS+=("$(basename "$script")" "$script")
# Get base name, remove underscores, and capitalize first letter
DISPLAY_NAME=$(basename "$script" | sed 's/_/ /g' | awk '{print toupper(substr($0,1,1)) tolower(substr($0,2))}')
MENU_OPTIONS+=("$DISPLAY_NAME" "")
SCRIPT_MAP["$DISPLAY_NAME"]="$script"
done
# Show the menu using whiptail
@ -29,9 +35,5 @@ CHOICE=$(whiptail --title "Script Selector" --menu "Choose a script to run:" 15
# Check if the user made a selection
if [[ -n "$CHOICE" ]]; then
SCRIPT_PATH="$SCRIPT_DIR/$CHOICE"
whiptail --msgbox "Running: $SCRIPT_PATH" 10 40
"$SCRIPT_PATH"
else
whiptail --msgbox "No script selected." 10 40
fi
SCRIPT_PATH="${SCRIPT_MAP[$CHOICE]}"
whiptail --msgbox "Running: $CHOICE