-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
48 lines (44 loc) · 1.21 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package pkg
import (
"errors"
)
var (
ErrManagerNotInstalled = errors.New("the package manager isn't installed")
ErrPkgNotExists = errors.New("the package not exists")
ErrPkgNotInstalled = errors.New("the package isn't installed")
ErrNotAdministrator = errors.New("not running as adminstrator")
ErrPkgNotFound = errors.New("package not found")
ErrManagerIsInstalled = errors.New("the package manager is not installed")
)
// TODO:Comment and document this.
type Packager interface {
Install() error
Uninstall() error
Reinstall() error
Version() string
Name() string
Installed() bool
Manager() Managerer
Local() bool
Repo() bool
}
// TODO:Comment and document this.
// TODO: Unbloat this...?
type Managerer interface {
Name() string
RequireAdmin() bool
InstallByName(...string) error
Install(...Packager) error
UninstallByName(...string) error
Uninstall(...Packager) error
Version() string
LocalPkgs() ([]Packager, error)
RepoPkgByName(string) (Packager, error)
LocalPkgByName(string) (Packager, error)
IsInstalled() bool
SearchInRepo(string) ([]Packager, error)
SearchInLocal(string) ([]Packager, error)
IsInRepo(Packager) bool
IsInLocal(Packager) bool
InstallManager() error
}