Skip to content

Commit 9327bc5

Browse files
v3.0 (feat): clear cmd package and add amd builder for initialization
1 parent ffa0ffb commit 9327bc5

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

cmd/cmd.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
package cmd
22

33
import (
4+
"embed"
45
"fmt"
56
"os"
67

78
"github.com/spf13/cobra"
89
"github.com/walmartdigital/commit-message-formatter/cmf"
10+
"github.com/walmartdigital/commit-message-formatter/fs"
911
git "github.com/walmartdigital/commit-message-formatter/git"
12+
promptxwrapper "github.com/walmartdigital/commit-message-formatter/promptxWrapper"
13+
"github.com/walmartdigital/commit-message-formatter/templaterunner"
1014
)
1115

1216
var cmfInstance cmf.CMF
@@ -18,9 +22,6 @@ var root = &cobra.Command{
1822
Long: "Generate custom commit message for your repo and standarize your commits log",
1923
Run: func(cmd *cobra.Command, args []string) {
2024
cmfInstance.CommitChanges()
21-
// go git.CheckTree()
22-
// message := template.Run()
23-
// git.Commit(message)
2425
},
2526
}
2627

@@ -29,7 +30,6 @@ var version = &cobra.Command{
2930
Short: "Version cmf",
3031
Long: "Display version of commit message formatter",
3132
Run: func(cmd *cobra.Command, args []string) {
32-
// fmt.Println("CMF - Commit Message Formatter v2.0")
3333
cmfInstance.GetVersion()
3434
},
3535
}
@@ -40,8 +40,6 @@ var amend = &cobra.Command{
4040
Long: "Amend last commit message",
4141
Run: func(cmd *cobra.Command, args []string) {
4242
cmfInstance.CommitAmend()
43-
// message := template.Run()
44-
// git.Amend(message)
4543
},
4644
}
4745

@@ -61,8 +59,11 @@ func Execute() {
6159
}
6260
}
6361

64-
func init() {
65-
cmfInstance = cmf.NewCMF(git.NewGitWrapper())
62+
func Build(vfs embed.FS) {
63+
fsManager := fs.NewFs(vfs)
64+
promptManager := promptxwrapper.NewPromptxWrapper()
65+
templateManager := templaterunner.NewTemplateRunner(promptManager)
66+
cmfInstance = cmf.NewCMF(git.NewGitWrapper(), templateManager, fsManager)
6667
root.AddCommand(version)
6768
root.AddCommand(boilerplateCMD)
6869
root.AddCommand(amend)

0 commit comments

Comments
 (0)