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