Last active
February 11, 2019 10:29
-
-
Save dnutiu/e6498ac2c3bf6d581a22daa6086d68ad to your computer and use it in GitHub Desktop.
Format all python files with black before comiting them.
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
| #!/usr/bin/env bash | |
| files=`git status | grep -e "modified:.*\.py" | sed -E "s/\s*modified:\s*//"` | |
| for FILE in ${files} | |
| do | |
| echo "Running black on" ${FILE} | |
| black ${FILE} | |
| done | |
| # Add modified stagged files back to stagged. | |
| git diff --name-only --cached | xargs -l git add |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment