-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathformat.sh
More file actions
23 lines (19 loc) · 859 Bytes
/
format.sh
File metadata and controls
23 lines (19 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
# ---------------------------------------------------------------------------
# format.sh — Format all C++/CUDA source files with clang-format.
#
# Requires clang-format in PATH.
# Install: sudo apt install clang-format (Ubuntu)
# or: pip install clang-format (any OS)
# ---------------------------------------------------------------------------
set -euo pipefail
if ! command -v clang-format &>/dev/null; then
echo "[ERROR] clang-format not found in PATH." >&2
echo " Install: sudo apt install clang-format (Ubuntu)" >&2
echo " or: pip install clang-format (any OS)" >&2
exit 1
fi
echo "Formatting files with clang-format $(clang-format --version)..."
find . -iname "*.cpp" -o -iname "*.hpp" -o -iname "*.cu" -o -iname "*.h" \
| xargs clang-format -i
echo "Files formatted successfully."