Created
October 10, 2018 22:54
-
-
Save svenmuennich/7dbb085a41583962cc15d6d42207bdd0 to your computer and use it in GitHub Desktop.
Fix whitespace
This file contains 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 | |
# Convert tabs to spaces (https://stackoverflow.com/a/11094620/981846) | |
find . \( -name '*.m' -o -name '*.h' -o -name '*.swift' -o -name '*.pch' \) ! -type d -exec bash -c 'expand -t 4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \; | |
# Trim trailing whitespace (https://stackoverflow.com/a/10711226/981846) | |
find . \( -name '*.m' -o -name '*.h' -o -name '*.swift' -o -name '*.pch' \) ! -type d -exec bash -c 'sed "s/[[:space:]]\{1,\}$//" "$0" > /tmp/e && mv /tmp/e "$0"' {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment