Skip to content

Commit 20c7802

Browse files
committed
refactor: Refactor git hooks and templates organization
- Add a new file `git/hook.go` with a `embed.FS` variable and a `util.LoadTemplates` call in the `init` function. - Rename `hook/templates/prepare-commit-msg` to `git/templates/prepare-commit-msg` with a 100% similarity index. - Delete the file `hook/hook.go` and remove the `hook` package.
1 parent e510f27 commit 20c7802

File tree

3 files changed

+21
-62
lines changed

3 files changed

+21
-62
lines changed

git/hook.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package git
2+
3+
import (
4+
"embed"
5+
"log"
6+
7+
"github.com/appleboy/CodeGPT/util"
8+
)
9+
10+
//go:embed templates/*
11+
var files embed.FS
12+
13+
const (
14+
CommitMessageTemplate = "prepare-commit-msg"
15+
)
16+
17+
func init() {
18+
if err := util.LoadTemplates(files); err != nil {
19+
log.Fatal(err)
20+
}
21+
}

hook/hook.go

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)