| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- #!/bin/sh
- if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then
- set -x
- fi
- if [ "$LEFTHOOK" = "0" ]; then
- exit 0
- fi
- call_lefthook()
- {
- if test -n "$LEFTHOOK_BIN"
- then
- "$LEFTHOOK_BIN" "$@"
- elif lefthook.exe -h >/dev/null 2>&1
- then
- lefthook.exe "$@"
- elif lefthook.bat -h >/dev/null 2>&1
- then
- lefthook.bat "$@"
- else
- dir="$(git rev-parse --show-toplevel)"
- osArch=$(uname | tr '[:upper:]' '[:lower:]')
- cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/')
- if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook.exe"
- then
- "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook.exe" "$@"
- elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook.exe"
- then
- "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook.exe" "$@"
- elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook.exe"
- then
- "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook.exe" "$@"
- elif test -f "$dir/node_modules/lefthook/bin/index.js"
- then
- "$dir/node_modules/lefthook/bin/index.js" "$@"
-
- elif go tool lefthook -h >/dev/null 2>&1
- then
- go tool lefthook "$@"
- elif bundle exec lefthook -h >/dev/null 2>&1
- then
- bundle exec lefthook "$@"
- elif yarn lefthook -h >/dev/null 2>&1
- then
- yarn lefthook "$@"
- elif pnpm lefthook -h >/dev/null 2>&1
- then
- pnpm lefthook "$@"
- elif swift package lefthook >/dev/null 2>&1
- then
- swift package --build-path .build/lefthook --disable-sandbox lefthook "$@"
- elif command -v mint >/dev/null 2>&1
- then
- mint run csjones/lefthook-plugin "$@"
- elif uv run lefthook -h >/dev/null 2>&1
- then
- uv run lefthook "$@"
- elif mise exec -- lefthook -h >/dev/null 2>&1
- then
- mise exec -- lefthook "$@"
- elif devbox run lefthook -h >/dev/null 2>&1
- then
- devbox run lefthook "$@"
- else
- echo "Can't find lefthook in PATH"
- fi
- fi
- }
- call_lefthook run "prepare-commit-msg" "$@"
|