Skip to content

Commit

Permalink
fix(hook.tmpl): adds cpu arch and os arch to lefthook's filepath (#260
Browse files Browse the repository at this point in the history
)

* fix(hook.tmpl): adds cpu arch and os arch to `lefthook`'s filepath

* fix: actually aarch64 it's the same as arm64
  • Loading branch information
rmachado-studocu committed Mar 31, 2022
1 parent c3b9420 commit c43d472
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/templates/hook.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ if [ -t 1 ] ; then
fi

dir="$(git rev-parse --show-toplevel)"
osArch=$(echo "$(uname)" | tr '[:upper:]' '[:lower:]')
cpuArch=$(echo "$(uname -m)" | sed 's/aarch64/arm64/')

call_lefthook()
{
if lefthook{{.Extension}} -h >/dev/null 2>&1
then
eval lefthook{{.Extension}} $@
elif test -f "$dir/node_modules/@arkweid/lefthook/bin/lefthook{{.Extension}}"
elif test -f "$dir/node_modules/@arkweid/lefthook/bin/lefthook_${osArch}_${cpuArch}/lefthook{{.Extension}}"
then
eval "$dir/node_modules/@arkweid/lefthook/bin/lefthook{{.Extension}} $@"
eval "$dir/node_modules/@arkweid/lefthook/bin/lefthook_${osArch}_${cpuArch}/lefthook{{.Extension}} $@"
elif bundle exec lefthook -h >/dev/null 2>&1
then
bundle exec lefthook $@
Expand Down

0 comments on commit c43d472

Please sign in to comment.