Skip to content

Commit

Permalink
Merge pull request #116 from fahrinh/fix/check-lefthook-existence
Browse files Browse the repository at this point in the history
Fix: use '-h' for robust lefthook (Go binary) existence checking
  • Loading branch information
Abroskin Alexander authored Mar 10, 2020
2 parents 2d6012a + 8602f75 commit 5691e6d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cmd/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ fi
` + autoInstall(hookName, fs) + "\n" + "cmd=\"lefthook run " + hookName + " $@\"" +
`
if lefthook >/dev/null 2>&1
if lefthook -h >/dev/null 2>&1
then
eval $cmd
elif bundle exec lefthook >/dev/null 2>&1
elif bundle exec lefthook -h >/dev/null 2>&1
then
bundle exec $cmd
elif npx lefthook >/dev/null 2>&1
elif npx lefthook -h >/dev/null 2>&1
then
npx $cmd
else
Expand Down Expand Up @@ -113,13 +113,13 @@ func autoInstall(hookName string, fs afero.Fs) string {
"cmd=\"lefthook install\"" +
`
if lefthook >/dev/null 2>&1
if lefthook -h >/dev/null 2>&1
then
eval $cmd
elif bundle exec lefthook >/dev/null 2>&1
elif bundle exec lefthook -h >/dev/null 2>&1
then
bundle exec $cmd
elif npx lefthook >/dev/null 2>&1
elif npx lefthook -h >/dev/null 2>&1
then
npx $cmd
fi
Expand Down

0 comments on commit 5691e6d

Please sign in to comment.