mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 22:35:42 +00:00
23 lines
479 B
Bash
Executable File
23 lines
479 B
Bash
Executable File
#!/bin/bash
|
|
# Pre-commit hook wrapper for scalafmt.
|
|
# Runs the repository-pinned scalafmt CLI through Bazel.
|
|
|
|
set -e
|
|
|
|
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
|
|
|
|
if [ "$#" -eq 0 ]; then
|
|
exit 0
|
|
fi
|
|
|
|
repo_root="$(git rev-parse --show-toplevel)"
|
|
files=()
|
|
for file in "$@"; do
|
|
case "$file" in
|
|
/*) files+=("$file") ;;
|
|
*) files+=("$repo_root/$file") ;;
|
|
esac
|
|
done
|
|
|
|
bazel run //tools:scalafmt -- --config "$repo_root/.scalafmt.conf" -i "${files[@]}"
|