func NewClient(execPath string, host string) (g *Client, err error) {
	g = new(Client)
	g.dotGitPath, err = utils.GetDotGitPath(execPath)
	g.host = host
	if err != nil {
		return
	}

	r, err := git.PlainOpen(g.dotGitPath)
	if err != nil {
		return
	}
	// get branch info
	ref, err := r.Head()
	if err != nil {
		return
	}
	g.branch = ref.Name().Short()
	// get github info
	remotes, err := r.Remotes()
	if err != nil {
		return
	}
	for _, remote := range remotes {
		if remote.Config().Name == "origin" {
			u := remote.Config().URLs[0]
			rep1 := regexp.MustCompile(`.*:(.*)/.*`)
			g.repoOwner = rep1.ReplaceAllString(u, "$1")
			rep2 := regexp.MustCompile(`.*/(.*)\.git`)
			g.repoName = rep2.ReplaceAllString(u, "$1")
			break
		}
	}
	return
}
// NewClient constructs a new Client
NewClient constructs a new Client
// NewClient constructs a new Client
func NewClient(execPath string, host string) (g *Client, err error) {
	g = new(Client)
	g.dotGitPath, err = utils.GetDotGitPath(execPath)
	g.host = host
	if err != nil {
		return
	}
	r, err := git.PlainOpen(g.dotGitPath)
	if err != nil {
		return
	}
	ref, err := r.Head()
	if err != nil {
		return
	}
	g.branch = ref.Name().Short()
	remotes, err := r.Remotes()
	if err != nil {
		return
	}
	for _, remote := range remotes {
		if remote.Config().Name == "origin" {
			u := remote.Config().URLs[0]
			rep1 := regexp.MustCompile(`.*:(.*)/.*`)
			g.repoOwner = rep1.ReplaceAllString(u, "$1")
			rep2 := regexp.MustCompile(`.*/(.*)\.git`)
			g.repoName = rep2.ReplaceAllString(u, "$1")
			break
		}
	}
	return
}
func NewClient ( execPath string , host string ) ( g * Client , err error ) { g = new ( Client ) g . dotGitPath , err = utils . GetDotGitPath ( execPath ) g . host = host if err != nil { return } r , err := git . PlainOpen ( g . dotGitPath ) if err != nil { return } ref , err := r . Head ( ) if err != nil { return } g . branch = ref . Name ( ) . Short ( ) remotes , err := r . Remotes ( ) if err != nil { return } for _ , remote := range remotes { if remote . Config ( ) . Name == " " { u := remote . Config ( ) . URLs [ 0 ] rep1 := regexp . MustCompile ( `.*:(.*)/.*` ) g . repoOwner = rep1 . ReplaceAllString ( u , " " ) rep2 := regexp . MustCompile ( `.*/(.*)\.git` ) g . repoName = rep2 . ReplaceAllString ( u , " " ) break } } return }
NewClient constructs a new Client
NewClient constructs a new Client
// get branch info // get github info