-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstyle
More file actions
34 lines (28 loc) · 796 Bytes
/
style
File metadata and controls
34 lines (28 loc) · 796 Bytes
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
#!/bin/bash
function usage () {
myName="$(basename "$0")"
echo "Current working directory = $(pwd)
${myName} - Use astyle to style source code.
Usage:
${myName} - No options, style all .h, .hpp, .c, and .cpp files in current working directory
${myName} [-h | --help | help | usage] - Show this help list
${myName} [file 1 [file 2 [...]]] - File list, style all files in the given file listing
"
exit 0;
}
while getopts h opt; do
case "$opt" in
h) usage
;;
esac
done
if [ "$1" = --help ] || [ "$1" = help ] || [ "$1" = usage ];then
usage
fi
optFile="$(dirname $(readlink -f "$0"))/libmacro.astylerc"
if [ $# -gt 0 ]; then
astyle --options="$optFile" "$@"
else
find . -regex '.*\.\(h\|c\|hpp\|hxx\|cpp\|cc\|tpp\)$' \
-exec astyle --options="$optFile" {} \;
fi