Skip to content

Commit e059efe

Browse files
add instruction to add pre-commit clang-format hook
1 parent e69c646 commit e059efe

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,10 @@ In some cases, you may need to perform a full clean that deletes all build artif
481481
```
482482

483483
### Clang format
484-
CPP SDK is using clang C++ format
484+
CPP SDK is using clang C++ format, and set up the pre-commit hook (run once):
485485
```bash
486486
brew install clang-format
487+
printf '#!/bin/sh\necho "Running clang-format..."\nFILES=$(git diff --cached --name-only -- "*.cpp" "*.cc" "*.h" "*.hpp")\n[ -z "$FILES" ] && exit 0\nfor f in $FILES; do clang-format -i "$f"; git add "$f"; done\necho "clang-format completed."\n' > .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit
487488
```
488489

489490

0 commit comments

Comments
 (0)