MCPcopy Create free account
hub / github.com/dirk/quickhook / install

Function install

install.go:17–43  ·  view source on GitHub ↗
(repo *repo.Repo, quickhook string, prompt bool)

Source from the content-addressed store, hash-verified

15)
16
17func install(repo *repo.Repo, quickhook string, prompt bool) error {
18 hooks, err := listHooks(repo)
19 if err != nil {
20 return err
21 }
22
23 for _, hook := range hooks {
24 shimPath := path.Join(".git", "hooks", hook)
25 if prompt {
26 shouldInstall, err := promptForInstallShim(os.Stdin, repo, shimPath)
27 if err != nil {
28 return err
29 }
30
31 if !shouldInstall {
32 fmt.Printf("Skipping installing shim %v\n", shimPath)
33 continue
34 }
35 }
36
37 installShim(repo, shimPath, quickhook, hook, prompt)
38
39 fmt.Printf("Installed shim %v\n", shimPath)
40 }
41
42 return nil
43}
44
45func listHooks(repo *repo.Repo) ([]string, error) {
46 hooksPath := path.Join(repo.Root, ".quickhook")

Callers 1

mainFunction · 0.85

Calls 3

listHooksFunction · 0.85
promptForInstallShimFunction · 0.85
installShimFunction · 0.85

Tested by

no test coverage detected