summaryrefslogtreecommitdiffhomepage
path: root/run_format.sh
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-05 21:10:18 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-05 21:10:18 +0200
commitf95d8bf159d10b5a9521dcaa0bc37aa0e9dfc02b (patch)
treebf8186f1a0521a64983bb0bca4f7b54883542195 /run_format.sh
parent5a903c1d8f80ca8d7bc5fbea0aea710ce0133f9d (diff)
MHR-23: Add run_format.sh, kernel patches.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'run_format.sh')
-rwxr-xr-xrun_format.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/run_format.sh b/run_format.sh
new file mode 100755
index 00000000..3ee63fc2
--- /dev/null
+++ b/run_format.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+THIS_PATH="$(realpath "$0")"
+THIS_DIR="$(dirname "$THIS_PATH")"
+
+# Find all files in THIS_DIR which end in .ino, .cpp, etc., as specified
+# in the regular expression just below
+FILE_LIST="$(find "$THIS_DIR" | grep -E ".*(\.ino|\.cpp|\.c|\.h|\.hpp|\.hxx|\.cxx|\.hh)$")"
+
+echo -e "Files found to format = \n\"\"\"\n$FILE_LIST\n\"\"\""
+
+# Format each file.
+# - NB: do NOT put quotes around `$FILE_LIST` below or else the `clang-format` command will
+# mistakenly see the entire blob of newline-separated file names as a SINGLE file name instead
+# of as a new-line separated list of *many* file names!
+clang-format --verbose -i --style=file $FILE_LIST