newRemoteNameToRepoFn takes a function that returns a list of remotes and returns a function that takes a remote name and returns the corresponding repository. It is a convenience function to call sites having to duplicate the same logic.
(remotesFn func() (ghContext.Remotes, error))
| 226 | // repository. It is a convenience function to call sites having to duplicate |
| 227 | // the same logic. |
| 228 | func newRemoteNameToRepoFn(remotesFn func() (ghContext.Remotes, error)) RemoteNameToRepoFn { |
| 229 | return func(remoteName string) (ghrepo.Interface, error) { |
| 230 | remotes, err := remotesFn() |
| 231 | if err != nil { |
| 232 | return nil, err |
| 233 | } |
| 234 | repo, err := remotes.FindByName(remoteName) |
| 235 | if err != nil { |
| 236 | return nil, err |
| 237 | } |
| 238 | return repo, nil |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | // remoteToRepoResolver provides a utility method to resolve a remote (either name or URL) |
| 243 | // to a repo (ghrepo.Interface). |
no test coverage detected