github.com/grantbow/bug@v0.3.1/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  
    17  	scm, _, err := scm.DetectSCM(options)
    18  	if err != nil {
    19  		fmt.Printf("Error: %s\n", err.Error())
    20  		return
    21  	}
    22  
    23  	err = scm.Commit(bugs.GetIssuesDir(), "Added or removed issues with the tool \"bug\"")
    24  
    25  	if err != nil {
    26  		fmt.Printf("Could not commit: %s\n", err.Error())
    27  		return
    28  	}
    29  }