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

Method Install

pkg/cmd/extension/manager.go:250–276  ·  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

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