2023-11-29 16:18:10 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
2023-12-03 18:24:45 +00:00
|
|
|
MIX_FILES=$(
|
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-03 18:32:45 +00:00
|
|
|
if [ -n "$MIX_FILES" ]; then
|
|
|
|
mix format "$MIX_FILES"
|
|
|
|
git add "$MIX_FILES"
|
|
|
|
fi
|
|
|
|
|
2023-12-03 18:24:45 +00:00
|
|
|
WEB_FILES=$(
|
2023-12-02 13:32:19 +00:00
|
|
|
git --no-pager diff --name-status --no-color --cached | \
|
|
|
|
awk '$1 != "D" && $2 ~ /\.jsx?$|\.tsx?$/ {print $NF}'
|
|
|
|
)
|
|
|
|
|
2023-12-03 18:32:45 +00:00
|
|
|
if [ -n "$WEB_FILES" ]; then
|
|
|
|
prettier --write "$WEB_FILES"
|
|
|
|
git add "$WEB_FILES"
|
|
|
|
fi
|