You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
628 B

  1. #!/usr/bin/env bash
  2. root=$(pwd)
  3. source="$root"/src
  4. function format() {
  5. filelist=$(ls "$1")
  6. pushd "$1"
  7. for file in $filelist; do
  8. if test -d "$file"; then
  9. echo "format directory $file"
  10. format "$file"
  11. else
  12. if ([ "${file%%.*}" != "base64" ] &&
  13. [ "${file%%.*}" != "json" ] &&
  14. [ "${file%%.*}" != "uthash" ]) &&
  15. ([ "${file##*.}" = "h" ] || [ "${file##*.}" = "c" ]); then
  16. echo "format file $file"
  17. uncrustify -c "$root"/.uncrustify.cfg -l C --replace --no-backup "$file"
  18. rm ./*.uncrustify >/dev/null 2>&1
  19. fi
  20. fi
  21. done
  22. popd
  23. }
  24. format "$source"