diff --git a/toolbox b/toolbox index f781805..23742ba 100644 --- a/toolbox +++ b/toolbox @@ -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 \ No newline at end of file