(repo *repo.Repo, quickhook string, prompt bool)
| 15 | ) |
| 16 | |
| 17 | func 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 | |
| 45 | func listHooks(repo *repo.Repo) ([]string, error) { |
| 46 | hooksPath := path.Join(repo.Root, ".quickhook") |
no test coverage detected