Install installs an extension from repo, and pins to commitish if provided
(repo ghrepo.Interface, target string)
| 248 | |
| 249 | // Install installs an extension from repo, and pins to commitish if provided |
| 250 | func (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 | |
| 278 | func (m *Manager) installBin(repo ghrepo.Interface, target string) error { |
| 279 | var r *release |
nothing calls this directly
no test coverage detected