1
1
package cmd
2
2
3
3
import (
4
+ "embed"
4
5
"fmt"
5
6
"os"
6
7
7
8
"github.com/spf13/cobra"
8
9
"github.com/walmartdigital/commit-message-formatter/cmf"
10
+ "github.com/walmartdigital/commit-message-formatter/fs"
9
11
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"
10
14
)
11
15
12
16
var cmfInstance cmf.CMF
@@ -18,9 +22,6 @@ var root = &cobra.Command{
18
22
Long : "Generate custom commit message for your repo and standarize your commits log" ,
19
23
Run : func (cmd * cobra.Command , args []string ) {
20
24
cmfInstance .CommitChanges ()
21
- // go git.CheckTree()
22
- // message := template.Run()
23
- // git.Commit(message)
24
25
},
25
26
}
26
27
@@ -29,7 +30,6 @@ var version = &cobra.Command{
29
30
Short : "Version cmf" ,
30
31
Long : "Display version of commit message formatter" ,
31
32
Run : func (cmd * cobra.Command , args []string ) {
32
- // fmt.Println("CMF - Commit Message Formatter v2.0")
33
33
cmfInstance .GetVersion ()
34
34
},
35
35
}
@@ -40,8 +40,6 @@ var amend = &cobra.Command{
40
40
Long : "Amend last commit message" ,
41
41
Run : func (cmd * cobra.Command , args []string ) {
42
42
cmfInstance .CommitAmend ()
43
- // message := template.Run()
44
- // git.Amend(message)
45
43
},
46
44
}
47
45
@@ -61,8 +59,11 @@ func Execute() {
61
59
}
62
60
}
63
61
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 )
66
67
root .AddCommand (version )
67
68
root .AddCommand (boilerplateCMD )
68
69
root .AddCommand (amend )
0 commit comments