Skip to content

Commit 486b489

Browse files
feat(cmf): add amend logic
1 parent 7849a46 commit 486b489

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cmf/cmf.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,18 @@ func (cmfInstance *cmf) CommitChanges() {
6969

7070
// CommitAmend perform a commit amend over current repository
7171
func (cmfInstance *cmf) CommitAmend() {
72-
fmt.Println("amend!!")
72+
cmfInstance.repository.CheckWorkspaceChanges()
73+
currentDirectory, _ := cmfInstance.fs.GetCurrentDirectory()
74+
cmfFile, err := cmfInstance.fs.GetFileFromFS(currentDirectory + "/" + defaultCMFFile)
75+
if err != nil {
76+
cmfFile, _ = cmfInstance.fs.GetFileFromVirtualFS(defaultYamlFile)
77+
}
78+
79+
extra := map[string]string{
80+
"BRANCH_NAME": cmfInstance.repository.BranchName(),
81+
}
82+
message, _ := cmfInstance.templateManager.Run(cmfFile, extra)
83+
cmfInstance.repository.Amend(message)
7384
}
7485

7586
// InitializeProject initialize current directory with a inner cmf template

0 commit comments

Comments
 (0)