MCPcopy Create free account
hub / github.com/cli/cli / IsOfficial

Function IsOfficial

pkg/extensions/official.go:44–54  ·  view source on GitHub ↗

IsOfficial reports whether the given extension command name and owner match an entry in the OfficialExtensions registry. Owner must be checked alongside name because a user may have installed a third-party extension that happens to share a name with one of ours (e.g. `someuser/gh-stack` predates `gi

(name, owner string)

Source from the content-addressed store, hash-verified

42// is case-insensitive because GitHub usernames and organization names
43// are themselves case-insensitive.
44func IsOfficial(name, owner string) bool {
45 if owner == "" {
46 return false
47 }
48 for _, ext := range OfficialExtensions {
49 if ext.Name == name && strings.EqualFold(ext.Owner, owner) {
50 return true
51 }
52 }
53 return false
54}

Callers 2

NewCmdExtensionFunction · 0.92
TestIsOfficialFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestIsOfficialFunction · 0.68