20 lines
624 B
Go
20 lines
624 B
Go
package platform
|
|
|
|
import "context"
|
|
|
|
// PackageManager abstracts OS-level package operations so later plans
|
|
// can add Debian/Fedora without touching modules.
|
|
type PackageManager interface {
|
|
Name() string
|
|
IsInstalled(ctx context.Context, pkg string) (bool, error)
|
|
Install(ctx context.Context, pkgs []string) error
|
|
Update(ctx context.Context) error
|
|
}
|
|
|
|
// Runner executes a command with arguments. Injected into package managers
|
|
// so tests can stub shell-outs.
|
|
type Runner interface {
|
|
Run(ctx context.Context, name string, args ...string) error
|
|
Output(ctx context.Context, name string, args ...string) ([]byte, error)
|
|
}
|