@@ -18,40 +18,38 @@ call_lefthook()
18
18
lefthook " $@ "
19
19
else
20
20
dir=" $( git rev-parse --show-toplevel) "
21
- if test -f " $dir /node_modules/lefthook/bin/index.js"
21
+ osArch=$( uname | tr ' [:upper:]' ' [:lower:]' )
22
+ cpuArch=$( uname -m | sed ' s/aarch64/arm64/;s/x86_64/x64/' )
23
+ if test -f " $dir /node_modules/lefthook-${osArch} -${cpuArch} /bin/lefthook"
24
+ then
25
+ " $dir /node_modules/lefthook-${osArch} -${cpuArch} /bin/lefthook" " $@ "
26
+ elif test -f " $dir /node_modules/@evilmartians/lefthook/bin/lefthook-${osArch} -${cpuArch} /lefthook"
27
+ then
28
+ " $dir /node_modules/@evilmartians/lefthook/bin/lefthook-${osArch} -${cpuArch} /lefthook" " $@ "
29
+ elif test -f " $dir /node_modules/@evilmartians/lefthook-installer/bin/lefthook"
30
+ then
31
+ " $dir /node_modules/@evilmartians/lefthook-installer/bin/lefthook" " $@ "
32
+ elif test -f " $dir /node_modules/lefthook/bin/index.js"
22
33
then
23
34
" $dir /node_modules/lefthook/bin/index.js" " $@ "
35
+
36
+ elif bundle exec lefthook -h > /dev/null 2>&1
37
+ then
38
+ bundle exec lefthook " $@ "
39
+ elif yarn lefthook -h > /dev/null 2>&1
40
+ then
41
+ yarn lefthook " $@ "
42
+ elif pnpm lefthook -h > /dev/null 2>&1
43
+ then
44
+ pnpm lefthook " $@ "
45
+ elif swift package plugin lefthook > /dev/null 2>&1
46
+ then
47
+ swift package --disable-sandbox plugin lefthook " $@ "
48
+ elif command -v mint > /dev/null 2>&1
49
+ then
50
+ mint run csjones/lefthook-plugin " $@ "
24
51
else
25
- osArch=$( uname | tr ' [:upper:]' ' [:lower:]' )
26
- cpuArch=$( uname -m | sed ' s/aarch64/arm64/' )
27
- if test -f " $dir /node_modules/@evilmartians/lefthook/bin/lefthook_${osArch} _${cpuArch} /lefthook"
28
- then
29
- " $dir /node_modules/@evilmartians/lefthook/bin/lefthook_${osArch} _${cpuArch} /lefthook" " $@ "
30
- elif test -f " $dir /node_modules/@evilmartians/lefthook-installer/bin/lefthook_${osArch} _${cpuArch} /lefthook"
31
- then
32
- " $dir /node_modules/@evilmartians/lefthook-installer/bin/lefthook_${osArch} _${cpuArch} /lefthook" " $@ "
33
-
34
- elif bundle exec lefthook -h > /dev/null 2>&1
35
- then
36
- bundle exec lefthook " $@ "
37
- elif yarn lefthook -h > /dev/null 2>&1
38
- then
39
- yarn lefthook " $@ "
40
- elif pnpm lefthook -h > /dev/null 2>&1
41
- then
42
- pnpm lefthook " $@ "
43
- elif swift package plugin lefthook > /dev/null 2>&1
44
- then
45
- swift package --disable-sandbox plugin lefthook " $@ "
46
- elif command -v mint > /dev/null 2>&1
47
- then
48
- mint run csjones/lefthook-plugin " $@ "
49
- elif command -v npx > /dev/null 2>&1
50
- then
51
- npx lefthook " $@ "
52
- else
53
- echo " Can't find lefthook in PATH"
54
- fi
52
+ echo " Can't find lefthook in PATH"
55
53
fi
56
54
fi
57
55
}
0 commit comments