Documentation ¶
Overview ¶
Package gitconfig enables you to use `~/.gitconfig` values in Golang.
For a full guide visit http://github.com/tcnksm/go-gitconfig
package main import ( "github.com/tcnksm/go-gitconfig" "fmt" ) func main() { user, err := gitconfig.Global("user.name") if err == nil { fmt.Println(user) } }
Index ¶
- Variables
- func Email() (string, error)
- func Entire(key string) (string, error)
- func GithubToken() (string, error)
- func GithubUser() (string, error)
- func Global(key string) (string, error)
- func Local(key string) (string, error)
- func OriginURL() (string, error)
- func Repository() (string, error)
- func Username() (string, error)
Constants ¶
This section is empty.
Variables ¶
var RepoNameRegexp = regexp.MustCompile(`.+/([^/]+)(\.git)?$`)
Functions ¶
func Email ¶
Email extracts git user email from `$HOME/.gitconfig` file or `$GIT_CONFIG`. This is same as Global("user.email")
func Entire ¶
Entire extracts configuration value from `$HOME/.gitconfig` file , `$GIT_CONFIG`, /etc/gitconfig or include.path files.
func GithubToken ¶
Github extracts github token from `Entire gitconfig`. This is same as Entire("github.token")
func GithubUser ¶
GithubUser extracts github.user name from `Entire gitconfig` This is same as Entire("github.user")
func OriginURL ¶
OriginURL extract remote origin url from current project repository. This is same as Local("remote.origin.url")
func Repository ¶
Repository extract repository name of current project repository.
Types ¶
This section is empty.