FindByName returns the first Remote whose name matches the list
(names ...string)
| 14 | |
| 15 | // FindByName returns the first Remote whose name matches the list |
| 16 | func (r Remotes) FindByName(names ...string) (*Remote, error) { |
| 17 | for _, name := range names { |
| 18 | for _, rem := range r { |
| 19 | if rem.Name == name || name == "*" { |
| 20 | return rem, nil |
| 21 | } |
| 22 | } |
| 23 | } |
| 24 | return nil, fmt.Errorf("no matching remote found") |
| 25 | } |
| 26 | |
| 27 | // FindByRepo returns the first Remote that points to a specific GitHub repository |
| 28 | func (r Remotes) FindByRepo(owner, name string) (*Remote, error) { |