repositorypackage
0.0.0-20160409144229-d53da5028b75
Repository: https://github.com/motemen/go-gitconfig.git
Documentation: pkg.go.dev
# README
go-gitconfig
Go library for loading git config
Synopsis
Struct loading
import "github.com/motemen/go-gitconfig"
type C struct {
UserEmail string `gitconfig:"user.email"`
PullRebase bool `gitconfig:"pull.rebase"`
}
func main() {
var config C
err := gitconfig.Load(&config)
...
}
Or simply access the key
url, err := gitconfig.GetString("remote.origin.url")
n, err := gitconfig.GetInt64("gc.auto")
Specifying sources
Use below to change git config sources:
gitconfig.Global
gitconfig.Local
gitconfig.File(file)
gitconfig.Blob(blob)
Author
motemen [email protected]