Minor optimization: Remove redundant subshell array building in restore
- Moved mapfile call before the display loop - Eliminates redundant array manipulation in subshell - Same functionality, slightly more efficient - No behavioral change, just code cleanup Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2185,20 +2185,17 @@ restore_configurations() {
|
||||
return
|
||||
fi
|
||||
|
||||
# Display backups
|
||||
# Display backups and store backup names in array for selection
|
||||
local backup_array=()
|
||||
local index=1
|
||||
mapfile -t backup_array < <(echo "$backups" | tail -n +2 | cut -d'|' -f1)
|
||||
|
||||
local index=1
|
||||
echo "$backups" | tail -n +2 | while IFS='|' read -r backup_name created username domain file_count; do
|
||||
printf "${GREEN}%3d${NC}) %-20s %s ${CYAN}[%s]${NC} ${YELLOW}(%s)${NC} %s files\n" \
|
||||
"$index" "$backup_name" "$created" "$username" "$domain" "$file_count"
|
||||
backup_array+=("$backup_name")
|
||||
index=$((index + 1))
|
||||
done
|
||||
|
||||
# Store backup names in array for selection
|
||||
mapfile -t backup_array < <(echo "$backups" | tail -n +2 | cut -d'|' -f1)
|
||||
|
||||
echo ""
|
||||
cecho "${CYAN}─────────────────────────────────────────────────────────────────────${NC}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user