Guest User

Untitled

a guest
Apr 21st, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. function exclude_odd_folders_and_format {
  4. egrep -v "^Pods|^tools" | tr '\n' '\0' | xargs -0 clang-format -i -style=file
  5. }
  6. export -f exclude_odd_folders_and_format
  7.  
  8. if [ $# -eq 0 ]; then
  9. find . -type f -name *.h -o -name *.m -o -name *.mm | sed "s/^\.\///g" | exclude_odd_folders_and_format
  10. exit 0
  11. elif [ "$1" == "--only-modified" ]; then
  12. git status --porcelain | grep -e "^ \\?[AM]" | sed "s/^...//" | grep -E '(.*\.h|.*\.m|.*\.mm)$' | exclude_odd_folders_and_format
  13. exit 0
  14. fi
  15.  
  16. echo "Unknown argument"
  17. exit 1
Add Comment
Please, Sign In to add comment