Actualiser toolbox

This commit is contained in:
Tyleo Dv. Delaware 2025-05-29 03:05:15 +02:00
parent 81fd8f1d07
commit 81cda2f8a2

15
toolbox
View file

@ -25,9 +25,12 @@ declare -A SCRIPT_MAP
for script in "${SCRIPTS[@]}"; do for script in "${SCRIPTS[@]}"; do
# Get base name, remove underscores, and capitalize first letter # 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))}') DISPLAY_NAME=$(basename "$script" | sed 's/_/ /g' | awk '{print toupper(substr($0,1,1)) tolower(substr($0,2))}')
MENU_OPTIONS+=("$DISPLAY_NAME" "") # Exclude scripts with "Toolbox" in the name
SCRIPT_MAP["$DISPLAY_NAME"]="$script" if [[ "$DISPLAY_NAME" != *"Toolbox"* ]]; then
MENU_OPTIONS+=("$DISPLAY_NAME" "")
SCRIPT_MAP["$DISPLAY_NAME"]="$script"
fi
done done
# Show the menu using whiptail # Show the menu using whiptail
@ -36,4 +39,8 @@ CHOICE=$(whiptail --title "Script Selector" --menu "Choose a script to run:" 15
# Check if the user made a selection # Check if the user made a selection
if [[ -n "$CHOICE" ]]; then if [[ -n "$CHOICE" ]]; then
SCRIPT_PATH="${SCRIPT_MAP[$CHOICE]}" SCRIPT_PATH="${SCRIPT_MAP[$CHOICE]}"
whiptail --msgbox "Running: $CHOICE whiptail --msgbox "Running: $CHOICE" 10 40
"$SCRIPT_PATH"
else
whiptail --msgbox "No script selected." 10 40
fi