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

Function IsOfficial

pkg/extensions/official.go:48–57  ·  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

(ext Extension)

Source from the content-addressed store, hash-verified

46// git-installed extension spawns git, and this is called for every installed
47// extension on every gh invocation. Official extension names are unique.
48func IsOfficial(ext Extension) bool {
49 name := ext.Name()
50 for _, official := range OfficialExtensions {
51 if official.Name == name {
52 owner := ext.Owner()
53 return owner != "" && strings.EqualFold(official.Owner, owner)
54 }
55 }
56 return false
57}

Callers 3

NewCmdExtensionFunction · 0.92
TestIsOfficialFunction · 0.85

Calls 2

NameMethod · 0.65
OwnerMethod · 0.65