MCPcopy
hub / github.com/cli/cli / FilterByHosts

Method FilterByHosts

context/remote.go:38–49  ·  view source on GitHub ↗

Filter remotes by given hostnames, maintains original order

(hosts []string)

Source from the content-addressed store, hash-verified

36
37// Filter remotes by given hostnames, maintains original order
38func (r Remotes) FilterByHosts(hosts []string) Remotes {
39 filtered := make(Remotes, 0)
40 for _, rr := range r {
41 for _, host := range hosts {
42 if strings.EqualFold(rr.RepoHost(), host) {
43 filtered = append(filtered, rr)
44 break
45 }
46 }
47 }
48 return filtered
49}
50
51func (r Remotes) ResolvedRemote() (*Remote, error) {
52 for _, rr := range r {

Callers 2

Test_FilterByHostsFunction · 0.95
ResolverMethod · 0.80

Calls 1

RepoHostMethod · 0.65

Tested by 1

Test_FilterByHostsFunction · 0.76