aboutsummaryrefslogtreecommitdiff
path: root/buildroot/bin/format_code
diff options
context:
space:
mode:
authorGeorgiy Bondarenko <69736697+nehilo@users.noreply.github.com>2021-03-04 20:54:23 +0300
committerGeorgiy Bondarenko <69736697+nehilo@users.noreply.github.com>2021-03-04 20:54:23 +0300
commite8701195e66f2d27ffe17fb514eae8173795aaf7 (patch)
tree9f519c4abf6556b9ae7190a6210d87ead1dfadde /buildroot/bin/format_code
downloadkp3s-lgvl-e8701195e66f2d27ffe17fb514eae8173795aaf7.tar.xz
kp3s-lgvl-e8701195e66f2d27ffe17fb514eae8173795aaf7.zip
Initial commit
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