-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathaddSanity.sh
More file actions
executable file
·22 lines (18 loc) · 995 Bytes
/
addSanity.sh
File metadata and controls
executable file
·22 lines (18 loc) · 995 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env bash
set -ex
# $(replace_in_file pattern file)
function replace_in_file() {
OS=`uname`
if [ "$OS" = 'Darwin' ]; then
# for MacOS
sed -i '' -e "$1" "$2"
else
# for Linux and Windows
sed -i'' -e "$1" "$2"
fi
}
export -f replace_in_file
find builder -type f -name "*.hs" -print0 | xargs -0 -I {} bash -c 'replace_in_file "s/import Data.Map ((!))/import Sanity ((!), debugFind) -- Data.Map ((!))/g" "$@"' _ {}
find compiler -type f -name "*.hs" -print0 | xargs -0 -I {} bash -c 'replace_in_file "s/import Data.Map ((!))/import Sanity ((!), debugFind) -- Data.Map ((!))/g" "$@"' _ {}
find builder -type f -name "*.hs" -print0 | xargs -0 -I {} bash -c 'replace_in_file "s/import Data.Map.Strict ((!))/import Sanity ((!), debugFind) -- Data.Map.Strict ((!))/g" "$@"' _ {}
find compiler -type f -name "*.hs" -print0 | xargs -0 -I {} bash -c 'replace_in_file "s/import Data.Map.Strict ((!))/import Sanity ((!), debugFind) -- Data.Map.Strict ((!))/g" "$@"' _ {}