nix-amer/internal/pkg/apk.go

28 lines
580 B
Go
Raw Normal View History

package pkg
2018-11-13 12:10:55 +00:00
import "github.com/xdrm-brackets/nix-amer/internal/exec"
type apk struct{ exec exec.Executor }
func (d *apk) SetExecutor(_exec exec.Executor) {
d.exec = _exec
}
func (d apk) Name() string { return "apk" }
func (d apk) Fetch() error {
return d.exec.Command(d.Name(), "update").Run()
}
func (d apk) Upgrade() error {
return d.exec.Command(d.Name(), "upgrade").Run()
}
func (d apk) Install(_pkg string) error {
return d.exec.Command(d.Name(), "add", _pkg).Run()
}
func (d apk) Remove(_pkg string) error {
return d.exec.Command(d.Name(), "del", _pkg).Run()
}