nix-amer/internal/pkg/eopkg.go

33 lines
702 B
Go

package pkg
import "github.com/xdrm-brackets/nix-amer/internal/exec"
type eopkg struct{ exec exec.Executor }
func (d *eopkg) SetExecutor(_exec exec.Executor) {
d.exec = _exec
}
func (d eopkg) Name() string { return "eopkg" }
func (d eopkg) Fetch() error {
return nil
}
func (d eopkg) Upgrade() error {
err := d.exec.Command(d.Name(), "upgrade").Run()
d.exec.Command(d.Name(), "remove-orphans").Run()
return err
}
func (d eopkg) Install(_pkg string) error {
err := d.exec.Command(d.Name(), "install", _pkg).Run()
return err
}
func (d eopkg) Remove(_pkg string) error {
err := d.exec.Command(d.Name(), "remove", _pkg).Run()
d.exec.Command(d.Name(), "remove-orphans").Run()
return err
}