MCPcopy
hub / github.com/cli/cli / Install

Method Install

pkg/cmd/extension/manager.go:249–275  ·  view source on GitHub ↗

Install installs an extension from repo, and pins to commitish if provided

(repo ghrepo.Interface, target string)

Source from the content-addressed store, hash-verified

247
248// Install installs an extension from repo, and pins to commitish if provided
249func (m *Manager) Install(repo ghrepo.Interface, target string) error {
250 isBin, err := isBinExtension(m.client, repo)
251 if err != nil {
252 if errors.Is(err, releaseNotFoundErr) {
253 if ok, err := repoExists(m.client, repo); err != nil {
254 return err
255 } else if !ok {
256 return repositoryNotFoundErr
257 }
258 } else {
259 return fmt.Errorf("could not check for binary extension: %w", err)
260 }
261 }
262 if isBin {
263 return m.installBin(repo, target)
264 }
265
266 hs, err := hasScript(m.client, repo)
267 if err != nil {
268 return err
269 }
270 if !hs {
271 return fmt.Errorf("extension is not installable: no usable release artifact or script found in %s", ghrepo.FullName(repo))
272 }
273
274 return m.installGit(repo, target)
275}
276
277func (m *Manager) installBin(repo ghrepo.Interface, target string) error {
278 var r *release

Callers

nothing calls this directly

Calls 7

installBinMethod · 0.95
installGitMethod · 0.95
FullNameFunction · 0.92
isBinExtensionFunction · 0.85
repoExistsFunction · 0.85
hasScriptFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected