feat(platform): add PackageManager interface and Pacman implementation
This commit is contained in:
19
internal/platform/pkgmgr.go
Normal file
19
internal/platform/pkgmgr.go
Normal file
@@ -0,0 +1,19 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user