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

#!/usr/bin/env bash
root=$(pwd)
source="$root"/src
function format() {
filelist=$(ls "$1")
pushd "$1"
for file in $filelist; do
if test -d "$file"; then
echo "format directory $file"
format "$file"
else
if ([ "${file%%.*}" != "base64" ] &&
[ "${file%%.*}" != "json" ] &&
[ "${file%%.*}" != "uthash" ]) &&
([ "${file##*.}" = "h" ] || [ "${file##*.}" = "c" ]); then
echo "format file $file"
uncrustify -c "$root"/.uncrustify.cfg -l C --replace --no-backup "$file"
rm ./*.uncrustify >/dev/null 2>&1
fi
fi
done
popd
}
format "$source"