Created
May 18, 2020 13:16
-
-
Save georgescumihai/280bfa0096bdeceb184478ec4d7bfa99 to your computer and use it in GitHub Desktop.
Swiftformat pre-commit hook
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/sh | |
# | |
SWIFTFORMAT_FILEPATH=".swiftformat" | |
# Workaround for SourceTree | |
export PATH=/usr/local/bin:$PATH | |
git diff --diff-filter=d --staged --name-only | grep -e '\.swift$' | while read line; do | |
swiftformat --config $SWIFTFORMAT_FILEPATH $line "${line}"; | |
git add "$line"; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment