summaryrefslogtreecommitdiffstats
path: root/reformat
diff options
context:
space:
mode:
Diffstat (limited to 'reformat')
-rwxr-xr-xreformat22
1 files changed, 22 insertions, 0 deletions
diff --git a/reformat b/reformat
new file mode 100755
index 0000000..1b98e8c
--- /dev/null
+++ b/reformat
@@ -0,0 +1,22 @@
+#! /bin/bash
+
+ASTYLEOPTS="-v \
+ --indent=spaces=4 \
+ --brackets=attach \
+ --pad-paren-in \
+ --indent-classes \
+ --indent-preprocessor \
+ --align-pointer=type \
+ --suffix=none \
+ --formatted
+ "
+if [ $# -eq 0 ]; then
+ echo "need at least one argument" && exit 1
+fi
+
+CMD=$(which astyle)
+if [ "X${CMD}" != "X" ]; then
+ echo $CMD $ASTYLEOPTS $@
+ $CMD $ASTYLEOPTS $@
+fi
+