diff options
Diffstat (limited to 'replace_glog.sh')
| -rwxr-xr-x | replace_glog.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/replace_glog.sh b/replace_glog.sh new file mode 100755 index 000000000..1a9d82092 --- /dev/null +++ b/replace_glog.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# Find all Go files containing glog calls +files=$(grep -l "glog\." --include="*.go" -r .) + +# Check if any files were found +if [ -z "$files" ]; then + echo "No files found containing glog calls" + exit 0 +fi + +# Print the files that will be modified +echo "The following files will be modified:" +echo "$files" +echo + +# Ask for confirmation +read -p "Do you want to proceed with the replacement? (y/n) " -n 1 -r +echo +if [[ ! $REPLY =~ ^[Yy]$ ]]; then + echo "Operation cancelled" + exit 1 +fi + +# Make the replacements +for file in $files; do + echo "Processing $file" + # Replace all glog function calls with log + sed -i '' 's/glog\./log\./g' "$file" +done + +echo "Replacement complete!"
\ No newline at end of file |
