-
Notifications
You must be signed in to change notification settings - Fork 241
Expand file tree
/
Copy pathadd_license.sh
More file actions
executable file
·26 lines (22 loc) · 902 Bytes
/
add_license.sh
File metadata and controls
executable file
·26 lines (22 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash
LICENSE_TEXT=$(cat scripts/license.txt) # Replace 'license.txt' with the actual path to your license file
# Iterate through all Python files
find docarray -name "*.py" -type f | while read -r file; do
# Check if the license text is already in the file
if ! grep -qF "$LICENSE_TEXT" "$file"; then
# Prepend license notice to the file
{ echo "$LICENSE_TEXT"; cat "$file"; } > tmpfile && mv tmpfile "$file"
else
echo "License already present in $file"
fi
done
# Iterate through all Python files
find tests -name "*.py" -type f | while read -r file; do
# Check if the license text is already in the file
if ! grep -qF "$LICENSE_TEXT" "$file"; then
# Prepend license notice to the file
{ echo "$LICENSE_TEXT"; cat "$file"; } > tmpfile && mv tmpfile "$file"
else
echo "License already present in $file"
fi
done