aboutsummaryrefslogtreecommitdiff
path: root/buildroot/bin/format_code
diff options
context:
space:
mode:
Diffstat (limited to 'buildroot/bin/format_code')
-rw-r--r--buildroot/bin/format_code30
1 files changed, 30 insertions, 0 deletions
diff --git a/buildroot/bin/format_code b/buildroot/bin/format_code
new file mode 100644
index 0000000..8ae04b1
--- /dev/null
+++ b/buildroot/bin/format_code
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+#
+# format_code [dir/file...]
+#
+
+HERE=`dirname $0`
+
+while [[ $# -gt 0 ]]; do
+
+ val="$1"
+
+ if [ -d "$val" ]; then
+
+ find $val -name *.cpp -exec "$HERE/uncrust" '{}' \;
+
+ elif [ -d "./Marlin/src/$val" ]; then
+
+ find "./Marlin/src/$val" -name *.cpp -exec "$HERE/uncrust" '{}' \;
+
+ elif [ -f "./Marlin/src/$val" ]; then
+
+ uncrust "./Marlin/src/$val"
+
+ elif [ -f "$val" ]; then
+
+ uncrust "$val"
+
+ fi
+
+done