31 lines
893 B
Bash
31 lines
893 B
Bash
#!/bin/bash
|
|
|
|
# Script to update all service methods from clientId *uuid.UUID to authToken string
|
|
# Usage: ./update_service_methods.sh <file_path>
|
|
|
|
if [ $# -eq 0 ]; then
|
|
echo "Usage: ./update_service_methods.sh <file_path>"
|
|
exit 1
|
|
fi
|
|
|
|
FILE_PATH=$1
|
|
|
|
if [ ! -f "$FILE_PATH" ]; then
|
|
echo "File not found: $FILE_PATH"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Updating service methods in: $FILE_PATH"
|
|
|
|
# Create backup
|
|
cp "$FILE_PATH" "${FILE_PATH}.backup"
|
|
|
|
# Update method signatures
|
|
sed -i 's/func (_i \*[a-zA-Z]*Service) \([A-Za-z]*\)(clientId \*uuid\.UUID, /func (_i *\1Service) \2(authToken string, /g' "$FILE_PATH"
|
|
|
|
# Add clientId extraction logic to each method
|
|
# This is a simplified approach - in practice, you'd need more sophisticated sed patterns
|
|
|
|
echo "Service methods updated. Please review the changes and add clientId extraction logic manually."
|
|
echo "Backup created at: ${FILE_PATH}.backup"
|