github.com/driusan/bug@v0.3.2-0.20190306121946-d7f4e7f33fea/bugapp/Commit.go (about) 1 package bugapp 2 3 import ( 4 "fmt" 5 "github.com/driusan/bug/bugs" 6 "github.com/driusan/bug/scm" 7 ) 8 9 func Commit(args ArgumentList) { 10 options := make(map[string]bool) 11 if !args.HasArgument("--no-autoclose") { 12 options["autoclose"] = true 13 } else { 14 options["autoclose"] = false 15 } 16 options["use_bug_prefix"] = true // SCM will ignore this option if it doesn't know it 17 18 scm, _, err := scm.DetectSCM(options) 19 if err != nil { 20 fmt.Printf("Error: %s\n", err.Error()) 21 return 22 } 23 24 err = scm.Commit(bugs.GetIssuesDir(), "Added or removed issues with the tool \"bug\"") 25 26 if err != nil { 27 fmt.Printf("Could not commit: %s\n", err.Error()) 28 return 29 } 30 }