Actualiser toolbox
This commit is contained in:
parent
2765a509f5
commit
81fd8f1d07
1 changed files with 9 additions and 7 deletions
16
toolbox
16
toolbox
|
@ -20,8 +20,14 @@ fi
|
||||||
|
|
||||||
# Prepare menu options
|
# Prepare menu options
|
||||||
MENU_OPTIONS=()
|
MENU_OPTIONS=()
|
||||||
|
declare -A SCRIPT_MAP
|
||||||
|
|
||||||
for script in "${SCRIPTS[@]}"; do
|
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
|
done
|
||||||
|
|
||||||
# Show the menu using whiptail
|
# 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
|
# Check if the user made a selection
|
||||||
if [[ -n "$CHOICE" ]]; then
|
if [[ -n "$CHOICE" ]]; then
|
||||||
SCRIPT_PATH="$SCRIPT_DIR/$CHOICE"
|
SCRIPT_PATH="${SCRIPT_MAP[$CHOICE]}"
|
||||||
whiptail --msgbox "Running: $SCRIPT_PATH" 10 40
|
whiptail --msgbox "Running: $CHOICE
|
||||||
"$SCRIPT_PATH"
|
|
||||||
else
|
|
||||||
whiptail --msgbox "No script selected." 10 40
|
|
||||||
fi
|
|
Loading…
Add table
Reference in a new issue