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