MCPcopy
hub / github.com/cli/cli / FindByName

Method FindByName

context/remote.go:16–25  ·  view source on GitHub ↗

FindByName returns the first Remote whose name matches the list

(names ...string)

Source from the content-addressed store, hash-verified

14
15// FindByName returns the first Remote whose name matches the list
16func (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
28func (r Remotes) FindByRepo(owner, name string) (*Remote, error) {

Callers 6

Test_Remotes_FindByNameFunction · 0.95
forkRunFunction · 0.80
NewCmdSetDefaultFunction · 0.80
newRemoteNameToRepoFnFunction · 0.80
NewCreateContextFunction · 0.80
handlePushFunction · 0.80

Calls 1

ErrorfMethod · 0.65

Tested by 1

Test_Remotes_FindByNameFunction · 0.76