Skip to content

Commit 5a4a69f

Browse files
author
Rodrigo Navarro
committed
no-story (feature): Add cmd package to register commands on cobra cli
1 parent 308c821 commit 5a4a69f

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

pkg/cmd/cmd.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ package cmd
22

33
import (
44
"boilerplate"
5-
"fmt"
5+
"template"
66

7+
"github.com/commit-message-formatter/pkg/git"
78
"github.com/spf13/cobra"
89
)
910

@@ -14,7 +15,20 @@ var Root = &cobra.Command{
1415
Long: "Generate custom commit message for your repo and standarize your commits log",
1516
PreRun: func(cmd *cobra.Command, args []string) {},
1617
Run: func(cmd *cobra.Command, args []string) {
17-
fmt.Println("RUN...")
18+
go git.CheckTree()
19+
message := template.Run()
20+
git.Commit(message)
21+
},
22+
}
23+
24+
var amend = &cobra.Command{
25+
Use: "amend",
26+
Short: "Amend commit message",
27+
Long: "Amend last commit message",
28+
PreRun: func(cmd *cobra.Command, args []string) {},
29+
Run: func(cmd *cobra.Command, args []string) {
30+
message := template.Run()
31+
git.Amend(message)
1832
},
1933
}
2034

@@ -30,4 +44,5 @@ var boilerplateCMD = &cobra.Command{
3044

3145
func init() {
3246
Root.AddCommand(boilerplateCMD)
47+
Root.AddCommand(amend)
3348
}

0 commit comments

Comments
 (0)