Last active
June 19, 2024 12:03
-
-
Save amiralles/0a979919e89c55fcaf7c2258c7685a91 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
set -e | |
# Get the list of changed files since the last commit | |
changed_files=$(git diff --name-only HEAD~1..HEAD) | |
if [ -z "$changed_files" ]; then | |
echo "No changes since the last commit." | |
exit 0 | |
fi | |
# Run mix format on each changed file | |
for file in $changed_files; do | |
if [[ $file == *.ex || $file == *.exs ]]; then | |
mix format $file | |
fi | |
done | |
echo "Formatting completed." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment