## Summary **What is the goal of this PR?** (e.g., Implements the new feature for file uploading.) Minor development tooling fix for nonstandard environments (NixOS, FreeBSD, Guix, etc.) **What changes are included?** - environment relative shebang in `clang-format-fix` - clang-format check in `clang-format-fix` --- ### AI Usage While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it helps set the right context for reviewers. Did you use AI tools to help write this code? _**NO**_
30 lines
1.1 KiB
Bash
Executable File
30 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Check if clang-format is availible
|
|
command -v clang-format >/dev/null 2>&1 || {
|
|
printf "'clang-format' not found in current environment\n"
|
|
printf "install 'clang', 'clang-tools', or 'clang-format' depending on your distro/os and tooling requirements\n"
|
|
exit 1
|
|
}
|
|
|
|
GIT_LS_FILES_FLAGS=""
|
|
if [[ "$1" == "-g" ]]; then
|
|
GIT_LS_FILES_FLAGS="--modified"
|
|
fi
|
|
|
|
|
|
# --- Main Logic ---
|
|
|
|
# Format all files (or only modified files if -g is passed)
|
|
|
|
# Use 'git ls-files' to get a list of all files tracked by git:
|
|
# --modified: files tracked by git that have been modified (staged or unstaged)
|
|
# --exclude-standard: ignores files in .gitignore
|
|
# Additionally exclude files in 'lib/EpdFont/builtinFonts/' as they are script-generated.
|
|
# Also exclude files in 'lib/Epub/Epub/hyphenation/generated/' as they are script-generated.
|
|
git ls-files --exclude-standard ${GIT_LS_FILES_FLAGS} \
|
|
| grep -E '\.(c|cpp|h|hpp)$' \
|
|
| grep -v -E '^lib/EpdFont/builtinFonts/' \
|
|
| grep -v -E '^lib/Epub/Epub/hyphenation/generated/' \
|
|
| xargs -r clang-format -style=file -i
|