Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
function exclude_odd_folders_and_format {
egrep -v "^Pods|^tools" | tr '\n' '\0' | xargs -0 clang-format -i -style=file
}
export -f exclude_odd_folders_and_format
if [ $# -eq 0 ]; then
find . -type f -name *.h -o -name *.m -o -name *.mm | sed "s/^\.\///g" | exclude_odd_folders_and_format
exit 0
elif [ "$1" == "--only-modified" ]; then
git status --porcelain | grep -e "^ \\?[AM]" | sed "s/^...//" | grep -E '(.*\.h|.*\.m|.*\.mm)$' | exclude_odd_folders_and_format
exit 0
fi
echo "Unknown argument"
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment