added a few tests to the new functionality

This commit is contained in:
Theis
2024-03-04 22:18:11 +01:00
parent 6ac34ad63d
commit 872cd7b5c0
2 changed files with 43 additions and 8 deletions
+13 -8
View File
@@ -17,10 +17,10 @@ type user struct {
var users = make(map[string]user)
var sb strings.Builder
var all_flag = false
func main() {
all_flag := false
// Reads a shell env variable :: author_file
authors := os.Getenv("author_file")
@@ -88,19 +88,15 @@ func main() {
skip_loop:
if len(excludeMode) > 0 || all_flag {
for key, user := range users {
if !slices.Contains(excludeMode, user.username) {
sb_author(key)
excludeMode = append(excludeMode, user.username)
}
}
add_x_users(excludeMode)
}
// commit msg built
commit := sb_build()
print(commit)
//NOTE: Uncomment for testing
//print(commit)
// commit shell command
cmd := exec.Command("git", "commit", "-m", commit)
@@ -117,6 +113,15 @@ func main() {
}
func add_x_users(excludeMode []string) {
for key, user := range users {
if !slices.Contains(excludeMode, user.username) {
sb_author(key)
excludeMode = append(excludeMode, user.username)
}
}
}
func sb_build() string {
return sb.String()
}