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

Method Install

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

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