MCPcopy
hub / github.com/cli/cli / Owner

Method Owner

pkg/cmd/extension/extension.go:182–212  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

180}
181
182func (e *Extension) Owner() string {
183 e.mu.RLock()
184 if e.owner != "" {
185 defer e.mu.RUnlock()
186 return e.owner
187 }
188 e.mu.RUnlock()
189
190 var owner string
191 switch e.kind {
192 case LocalKind:
193 case BinaryKind:
194 if manifest, err := e.loadManifest(); err == nil {
195 owner = manifest.Owner
196 }
197 case GitKind:
198 if remoteURL, err := e.gitClient.Config("remote.origin.url"); err == nil {
199 if url, err := git.ParseURL(strings.TrimSpace(string(remoteURL))); err == nil {
200 if repo, err := ghrepo.FromURL(url); err == nil {
201 owner = repo.RepoOwner()
202 }
203 }
204 }
205 }
206
207 e.mu.Lock()
208 e.owner = owner
209 e.mu.Unlock()
210
211 return e.owner
212}
213
214func (e *Extension) UpdateAvailable() bool {
215 if e.IsLocal() ||

Callers 4

TestOwnerLocalExtensionFunction · 0.95
TestOwnerBinaryExtensionFunction · 0.95
TestOwnerGitExtensionFunction · 0.95
TestOwnerCachedFunction · 0.95

Calls 5

loadManifestMethod · 0.95
ParseURLFunction · 0.92
FromURLFunction · 0.92
ConfigMethod · 0.65
RepoOwnerMethod · 0.65

Tested by 4

TestOwnerLocalExtensionFunction · 0.76
TestOwnerBinaryExtensionFunction · 0.76
TestOwnerGitExtensionFunction · 0.76
TestOwnerCachedFunction · 0.76