- this was something I did in the original implementation of this improved extension update notification logic - discovering other parts of the extension manager code that were working with non-prefixed extension names motivated a different approach - the extension manager code that requires the extension be prefixed has been enhanced to use the centralized ensurePrefixed() logic, making the need for this on the extension unnecessary
42 lines
1,009 B
Go
42 lines
1,009 B
Go
package extensions
|
|
|
|
import (
|
|
"io"
|
|
|
|
"github.com/cli/cli/v2/internal/ghrepo"
|
|
)
|
|
|
|
type ExtTemplateType int
|
|
|
|
const (
|
|
GitTemplateType ExtTemplateType = 0
|
|
GoBinTemplateType ExtTemplateType = 1
|
|
OtherBinTemplateType ExtTemplateType = 2
|
|
)
|
|
|
|
//go:generate moq -rm -out extension_mock.go . Extension
|
|
type Extension interface {
|
|
Name() string // Extension Name without gh-
|
|
Path() string // Path to executable
|
|
URL() string
|
|
CurrentVersion() string
|
|
LatestVersion() string
|
|
IsPinned() bool
|
|
UpdateAvailable() bool
|
|
IsBinary() bool
|
|
IsLocal() bool
|
|
Owner() string
|
|
}
|
|
|
|
//go:generate moq -rm -out manager_mock.go . ExtensionManager
|
|
type ExtensionManager interface {
|
|
List() []Extension
|
|
Install(ghrepo.Interface, string) error
|
|
InstallLocal(dir string) error
|
|
Upgrade(name string, force bool) error
|
|
Remove(name string) error
|
|
Dispatch(args []string, stdin io.Reader, stdout, stderr io.Writer) (bool, error)
|
|
Create(name string, tmplType ExtTemplateType) error
|
|
EnableDryRunMode()
|
|
UpdateDir(name string) string
|
|
}
|