2023-11-29 16:18:10 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
2023-12-02 13:32:19 +00:00
|
|
|
mixFiles=$(
|
2023-11-29 16:18:10 +00:00
|
|
|
git --no-pager diff --name-status --no-color --cached | \
|
|
|
|
awk '$1 != "D" && $2 ~ /\.exs?$/ {print $NF}'
|
|
|
|
)
|
|
|
|
|
2023-12-02 13:32:19 +00:00
|
|
|
for path in $mixFiles
|
2023-11-29 16:18:10 +00:00
|
|
|
do
|
|
|
|
mix format "$path"
|
|
|
|
git add "$path"
|
|
|
|
done
|
2023-12-02 13:32:19 +00:00
|
|
|
|
|
|
|
webFiles=$(
|
|
|
|
git --no-pager diff --name-status --no-color --cached | \
|
|
|
|
awk '$1 != "D" && $2 ~ /\.jsx?$|\.tsx?$/ {print $NF}'
|
|
|
|
)
|
|
|
|
|
|
|
|
for path in $webFiles
|
|
|
|
do
|
|
|
|
prettier --write "$path"
|
|
|
|
git add "$path"
|
|
|
|
done
|