Last active
February 22, 2023 21:19
-
-
Save sthefanoss/8b329e298059b6d940aeb3b3b420dc0a to your computer and use it in GitHub Desktop.
Adds "//@Dart=2.9" on every .dart file inside /lib folder. Useful when migrating to null-safety.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adds "//@dart=2.9" on every .dart file inside /lib folder. | |
# Useful when migrating to null-safety. | |
addDart29ToFile() { | |
echo "//@dart=2.9" > tmpfile | |
cat "$1" >> tmpfile | |
mv tmpfile "$1" | |
} | |
runFolderRecursively () { | |
while [ "$1" ] ; do | |
if [ -d "$1" ] ; then | |
runFolderRecursively "$1"/* | |
else | |
if [[ "$1" == *.dart ]] ; then | |
addDart29ToFile "$1" | |
fi | |
fi | |
shift | |
done | |
} | |
runFolderRecursively lib |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Mex978 thanks