23 lines
457 B
Bash
Executable File
23 lines
457 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
MIX_FILES=$(
|
|
git --no-pager diff --name-status --no-color --cached | \
|
|
awk '$1 != "D" && $2 ~ /\.exs?$/ {print $NF}'
|
|
)
|
|
|
|
if [ -n "$MIX_FILES" ]; then
|
|
mix format "$MIX_FILES"
|
|
git add "$MIX_FILES"
|
|
fi
|
|
|
|
WEB_FILES=$(
|
|
git --no-pager diff --name-status --no-color --cached | \
|
|
awk '$1 != "D" && $2 ~ /\.jsx?$|\.tsx?$/ {print $NF}'
|
|
)
|
|
|
|
if [ -n "$WEB_FILES" ]; then
|
|
prettier --write "$WEB_FILES"
|
|
git add "$WEB_FILES"
|
|
fi
|