@@ -23,20 +23,21 @@ func main() {
2323 var startCommit = flag .String ("s" , "" , "commit hash string start collecting commit messages from" )
2424 var endCommit = flag .String ("e" , "" , "commit hash string to stop collecting commit message at" )
2525 var inclusionFlags = flag .String ("i" , "" , "commit types to be includes, defaults to CI FIX REFACTOR FEATURE DOCS CHORE TEST OTHER" )
26+ var skipClassification = flag .Bool ("skip" , false , "if true will skip trying to classify and just give a list of changes" )
2627
2728 flag .Parse ()
2829
2930 path := repoPath
3031
31- err := CommitLog (* path , * startCommit , * endCommit , * inclusionFlags )
32+ err := CommitLog (* path , * startCommit , * endCommit , * inclusionFlags , * skipClassification )
3233
3334 if err .err != nil {
3435 log .Fatal (err .message , err .err )
3536 }
3637}
3738
3839// CommitLog - Generate commit log
39- func CommitLog (path string , startCommitString string , endCommitString string , inclusionFlags string ) ErrMessage {
40+ func CommitLog (path string , startCommitString string , endCommitString string , inclusionFlags string , skipClassification bool ) ErrMessage {
4041 currentRepository := openRepository (path )
4142 baseCommitReference , err := currentRepository .Head ()
4243 var startHash , endHash * object.Commit
@@ -79,22 +80,26 @@ func CommitLog(path string, startCommitString string, endCommitString string, in
7980
8081 for _ , c := range commits {
8182 normalizedHash := c .Hash .String () + " - " + normalizeCommit (c .Message )
82- switch strings .SplitN (strings .TrimSpace (c .Message ), ":" , 2 )[0 ] {
83- case "ci" :
84- logContainer .CI = append (logContainer .CI , normalizedHash )
85- case "fix" :
86- logContainer .FIX = append (logContainer .FIX , normalizedHash )
87- case "refactor" :
88- logContainer .REFACTOR = append (logContainer .REFACTOR , normalizedHash )
89- case "feat" , "feature" :
90- logContainer .FEATURE = append (logContainer .FEATURE , normalizedHash )
91- case "docs" :
92- logContainer .DOCS = append (logContainer .DOCS , normalizedHash )
93- case "test" :
94- logContainer .TEST = append (logContainer .TEST , normalizedHash )
95- case "chore" :
96- logContainer .CHORE = append (logContainer .CHORE , normalizedHash )
97- default :
83+ if ! skipClassification {
84+ switch strings .SplitN (strings .TrimSpace (c .Message ), ":" , 2 )[0 ] {
85+ case "ci" :
86+ logContainer .CI = append (logContainer .CI , normalizedHash )
87+ case "fix" :
88+ logContainer .FIX = append (logContainer .FIX , normalizedHash )
89+ case "refactor" :
90+ logContainer .REFACTOR = append (logContainer .REFACTOR , normalizedHash )
91+ case "feat" , "feature" :
92+ logContainer .FEATURE = append (logContainer .FEATURE , normalizedHash )
93+ case "docs" :
94+ logContainer .DOCS = append (logContainer .DOCS , normalizedHash )
95+ case "test" :
96+ logContainer .TEST = append (logContainer .TEST , normalizedHash )
97+ case "chore" :
98+ logContainer .CHORE = append (logContainer .CHORE , normalizedHash )
99+ default :
100+ logContainer .OTHER = append (logContainer .OTHER , normalizedHash )
101+ }
102+ } else {
98103 logContainer .OTHER = append (logContainer .OTHER , normalizedHash )
99104 }
100105
@@ -104,7 +109,7 @@ func CommitLog(path string, startCommitString string, endCommitString string, in
104109 break
105110 }
106111 }
107- fmt .Println (logContainer .ToMarkdown ())
112+ fmt .Println (logContainer .ToMarkdown (skipClassification ))
108113
109114 return ErrMessage {}
110115}
0 commit comments