add GitHubRepository

This commit is contained in:
nate smith 2019-10-10 16:02:23 -05:00
parent 8558c279fc
commit 457ef18cdc
5 changed files with 125 additions and 22 deletions

View file

@ -99,3 +99,19 @@ func newRemote(name string, urlMap map[string]string) (Remote, error) {
return r, nil
}
// GuessRemote attempts to select and return the remote a user likely wants to target when dealing with GitHub repositories.
func GuessRemote() (Remote, error) {
remotes, err := Remotes()
if err != nil {
return Remote{}, err
}
if len(remotes) == 0 {
return Remote{}, fmt.Errorf("unable to guess remote")
}
// lol
return remotes[0], nil
}