Actualiser toolbox
This commit is contained in:
parent
0004040983
commit
da35160bc0
1 changed files with 3 additions and 10 deletions
11
toolbox
11
toolbox
|
@ -23,23 +23,16 @@ MENU_OPTIONS=()
|
||||||
declare -A SCRIPT_MAP
|
declare -A SCRIPT_MAP
|
||||||
|
|
||||||
for script in "${SCRIPTS[@]}"; do
|
for script in "${SCRIPTS[@]}"; do
|
||||||
# Get base name, remove underscores, capitalize first letters, and store mapping
|
# Get base name, remove underscores, and capitalize first letter of each word
|
||||||
DISPLAY_NAME=$(basename "$script" | sed 's/_/ /g' | awk '{for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) tolower(substr($i,2)); print}')
|
DISPLAY_NAME=$(basename "$script" | sed 's/_/ /g' | awk '{for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) tolower(substr($i,2)); print}')
|
||||||
|
|
||||||
# Exclude scripts with "Toolbox" in the name
|
# Exclude scripts with "Toolbox" in the name
|
||||||
if [[ "$DISPLAY_NAME" != *"Toolbox"* ]]; then
|
if [[ "$DISPLAY_NAME" != *"Toolbox"* ]]; then
|
||||||
|
MENU_OPTIONS+=("$DISPLAY_NAME" "")
|
||||||
SCRIPT_MAP["$DISPLAY_NAME"]="$script"
|
SCRIPT_MAP["$DISPLAY_NAME"]="$script"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Sort script names alphabetically
|
|
||||||
SORTED_NAMES=($(printf "%s\n" "${!SCRIPT_MAP[@]}" | sort))
|
|
||||||
|
|
||||||
# Populate menu options in sorted order
|
|
||||||
for name in "${SORTED_NAMES[@]}"; do
|
|
||||||
MENU_OPTIONS+=("$name" "")
|
|
||||||
done
|
|
||||||
|
|
||||||
# Show the menu using whiptail with the new title
|
# Show the menu using whiptail with the new title
|
||||||
CHOICE=$(whiptail --title "TyOS Setup Toolbox" --menu "Choose A Script To Run:" 15 50 5 "${MENU_OPTIONS[@]}" 3>&1 1>&2 2>&3)
|
CHOICE=$(whiptail --title "TyOS Setup Toolbox" --menu "Choose A Script To Run:" 15 50 5 "${MENU_OPTIONS[@]}" 3>&1 1>&2 2>&3)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue