-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformat
executable file
·38 lines (35 loc) · 1.42 KB
/
format
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
#Check if status is clean
if output=$(git status --untracked-files=no --porcelain) && [ -z "$output" ]; then
printf "\033[1;32m[OK]\e[0m Status is clean\n"
else
printf "\033[1;31m[ERR]\e[0m Status is dirty. Quitting.\n"
exit 1
fi
SRC_DIR="src"
SRC_CORE_DIR="src/core"
SRC_UTILS_DIR="src/utils"
SRC_BUILD_NC_DIR="src/build-nc"
SRC_BUILD_NC_W64_DIR="src/build-nc-w64"
SRC_BUILD_RL_DIR="src/build-rl"
SRC_SER_DIR="src/ser"
SRC_BSP_DIR="src/bsp"
hlpd_SOURCES=("$SRC_DIR"/*.c "$SRC_DIR"/*.h "$SRC_CORE_DIR"/*.c "$SRC_CORE_DIR"/*.h "$SRC_UTILS_DIR"/*.c "$SRC_UTILS_DIR"/*.h "$SRC_BUILD_NC_DIR"/*.c "$SRC_BUILD_NC_DIR"/*.h "$SRC_BUILD_NC_W64_DIR"/*.c "$SRC_BUILD_NC_W64_DIR"/*.h "$SRC_BUILD_RL_DIR"/*.c "$SRC_BUILD_RL_DIR"/*.h "$SRC_SER_DIR"/*.c "$SRC_SER_DIR"/*.h "$SRC_BSP_DIR"/*.c "$SRC_BSP_DIR"/*.h )
CONFIG_FILE=".astylerc"
printf "Running \033[1;34mastyle -s4 --style=linux\e[0m for all source files.\n"
for src_i in "${hlpd_SOURCES[@]}"; do {
astyle --options="$CONFIG_FILE" $src_i >/dev/null
printf "Ran astyle on [\033[1;35m$src_i\e[0m], status was [\033[1;33m$?\e[0m]\n"
}
done
printf "Removing all \033[1;34msrc/*.orig\e[0m files.\n"
for FILE in ${hlpd_SOURCES[@]}; do {
if [[ -f "$FILE.orig" ]] ; then {
rm "$FILE.orig" && printf "Removed [\033[1;36m$FILE.orig\e[0m]\n"
} else {
printf "[INFO] File [\033[1;33m$FILE.orig\e[0m] not found.\n"
}
fi
}
done
printf "\033[1;33mDone.\e[0m\n"