format_code 439 B

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/env bash
  2. #
  3. # format_code [dir/file...]
  4. #
  5. HERE=`dirname $0`
  6. while [[ $# -gt 0 ]]; do
  7. val="$1"
  8. if [ -d "$val" ]; then
  9. find $val -name *.cpp -exec "$HERE/uncrust" '{}' \;
  10. elif [ -d "./Marlin/src/$val" ]; then
  11. find "./Marlin/src/$val" -name *.cpp -exec "$HERE/uncrust" '{}' \;
  12. elif [ -f "./Marlin/src/$val" ]; then
  13. uncrust "./Marlin/src/$val"
  14. elif [ -f "$val" ]; then
  15. uncrust "$val"
  16. fi
  17. done