nix-amer/internal/pkg/pacman.go

33 lines
676 B
Go

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