Skip to content

Commit

Permalink
feat: remove hook instances utility function
Browse files Browse the repository at this point in the history
  • Loading branch information
JaleelB committed May 22, 2024
1 parent c3ebc26 commit 6e33d66
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion internal/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package internal

import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -61,4 +62,15 @@ func ExecuteCommand(command string, args ...string) (string, error) {
return "", fmt.Errorf("failed to execute command: %w", err)
}
return strings.TrimSpace(string(output)), nil
}
}

func RemoveGitHooks(hookPath string) error {
hooks := []string{"commit-msg", "post-checkout"}
for _, hook := range hooks {
hookFile := filepath.Join(hookPath, hook)
if err := os.Remove(hookFile); err != nil {
return fmt.Errorf("failed to remove %s: %w", hook, err)
}
}
return nil
}

0 comments on commit 6e33d66

Please sign in to comment.