unexport private package managers (internal/pkg)

This commit is contained in:
xdrm-brackets 2018-11-11 01:10:30 +01:00
parent 7475f0bd24
commit 87f983d018
7 changed files with 42 additions and 42 deletions

View File

@ -4,22 +4,22 @@ import (
"os/exec"
)
type Apk struct{}
type apk struct{}
func (d Apk) Name() string { return "apk" }
func (d apk) Name() string { return "apk" }
func (d Apk) Fetch() error {
func (d apk) Fetch() error {
return exec.Command(d.Name(), "update").Run()
}
func (d Apk) Upgrade() error {
func (d apk) Upgrade() error {
return exec.Command(d.Name(), "upgrade").Run()
}
func (d Apk) Install(_pkg string) error {
func (d apk) Install(_pkg string) error {
return exec.Command(d.Name(), "add", _pkg).Run()
}
func (d Apk) Remove(_pkg string) error {
func (d apk) Remove(_pkg string) error {
return exec.Command(d.Name(), "del", _pkg).Run()
}

View File

@ -4,16 +4,16 @@ import (
"os/exec"
)
type Apt struct{}
type aptGet struct{}
func (d Apt) Name() string { return "apt-get" }
func (d aptGet) Name() string { return "apt-get" }
func (d Apt) Fetch() error {
func (d aptGet) Fetch() error {
err := exec.Command(d.Name(), "update").Run()
return err
}
func (d Apt) Upgrade() error {
func (d aptGet) Upgrade() error {
err := exec.Command(d.Name(), "upgrade").Run()
if err != nil {
return err
@ -28,12 +28,12 @@ func (d Apt) Upgrade() error {
return nil
}
func (d Apt) Install(_pkg string) error {
func (d aptGet) Install(_pkg string) error {
err := exec.Command(d.Name(), "install", _pkg).Run()
return err
}
func (d Apt) Remove(_pkg string) error {
func (d aptGet) Remove(_pkg string) error {
err := exec.Command(d.Name(), "remove", _pkg).Run()
exec.Command(d.Name(), "autoremove").Run()
return err

View File

@ -4,25 +4,25 @@ import (
"os/exec"
)
type Dnf struct{}
type dnf struct{}
func (d Dnf) Name() string { return "dnf" }
func (d dnf) Name() string { return "dnf" }
func (d Dnf) Fetch() error {
func (d dnf) Fetch() error {
return nil
}
func (d Dnf) Upgrade() error {
func (d dnf) Upgrade() error {
err := exec.Command(d.Name(), "upgrade").Run()
exec.Command(d.Name(), "autoremove").Run()
return err
}
func (d Dnf) Install(_pkg string) error {
func (d dnf) Install(_pkg string) error {
return exec.Command(d.Name(), "install", _pkg).Run()
}
func (d Dnf) Remove(_pkg string) error {
func (d dnf) Remove(_pkg string) error {
err := exec.Command(d.Name(), "remove", _pkg).Run()
exec.Command(d.Name(), "autoremove").Run()
return err

View File

@ -4,26 +4,26 @@ import (
"os/exec"
)
type Eopkg struct{}
type eopkg struct{}
func (d Eopkg) Name() string { return "eopkg" }
func (d eopkg) Name() string { return "eopkg" }
func (d Eopkg) Fetch() error {
func (d eopkg) Fetch() error {
return nil
}
func (d Eopkg) Upgrade() error {
func (d eopkg) Upgrade() error {
err := exec.Command(d.Name(), "upgrade").Run()
exec.Command(d.Name(), "remove-orphans").Run()
return err
}
func (d Eopkg) Install(_pkg string) error {
func (d eopkg) Install(_pkg string) error {
err := exec.Command(d.Name(), "install", _pkg).Run()
return err
}
func (d Eopkg) Remove(_pkg string) error {
func (d eopkg) Remove(_pkg string) error {
err := exec.Command(d.Name(), "remove", _pkg).Run()
exec.Command(d.Name(), "remove-orphans").Run()
return err

View File

@ -13,17 +13,17 @@ func Load(_manager string) (PackageManager, error) {
var manager PackageManager
switch _manager {
case "apt-get":
manager = new(Apt)
manager = new(aptGet)
case "apk":
manager = new(Apk)
manager = new(apk)
case "eopkg":
manager = new(Eopkg)
manager = new(eopkg)
case "pacman":
manager = new(Pacman)
manager = new(pacman)
case "dnf":
manager = new(Dnf)
manager = new(dnf)
case "yum":
manager = new(Yum)
manager = new(yum)
default:
return nil, ErrUnknownManager
}

View File

@ -4,26 +4,26 @@ import (
"os/exec"
)
type Pacman struct{}
type pacman struct{}
func (d Pacman) Name() string { return "pacman" }
func (d pacman) Name() string { return "pacman" }
func (d Pacman) Fetch() error {
func (d pacman) Fetch() error {
return nil
}
func (d Pacman) Upgrade() error {
func (d pacman) Upgrade() error {
err := exec.Command(d.Name(), "-Syu").Run()
exec.Command(d.Name(), "-Ru").Run()
return err
}
func (d Pacman) Install(_pkg string) error {
func (d pacman) Install(_pkg string) error {
err := exec.Command(d.Name(), "-S", _pkg).Run()
return err
}
func (d Pacman) Remove(_pkg string) error {
func (d pacman) Remove(_pkg string) error {
err := exec.Command(d.Name(), "-R", _pkg).Run()
exec.Command(d.Name(), "-Ru").Run()
return err

View File

@ -4,22 +4,22 @@ import (
"os/exec"
)
type Yum struct{}
type yum struct{}
func (d Yum) Name() string { return "yum" }
func (d yum) Name() string { return "yum" }
func (d Yum) Fetch() error {
func (d yum) Fetch() error {
return nil
}
func (d Yum) Upgrade() error {
func (d yum) Upgrade() error {
return exec.Command(d.Name(), "update").Run()
}
func (d Yum) Install(_pkg string) error {
func (d yum) Install(_pkg string) error {
return exec.Command(d.Name(), "install", _pkg).Run()
}
func (d Yum) Remove(_pkg string) error {
func (d yum) Remove(_pkg string) error {
return exec.Command(d.Name(), "remove", _pkg).Run()
}