PackageManager just because
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
532 B

package Package
import (
"errors"
"fmt"
"os"
"PackageManager/Archive"
"PackageManager/Variables"
)
func InstallPackage(pkgs []string) error {
var (
pkg string
e error
)
for _, pkg = range pkgs {
_, e = os.Stat(pkg)
if os.IsNotExist(e) {
return errors.New(fmt.Sprintf("Invalid package %s", pkg))
}
}
for _, pkg = range pkgs {
fmt.Printf(
"Installing %s...\n",
pkg,
)
e = Archive.UntarGzip(pkg, Variables.RootDir)
fmt.Printf(
"%s successfully installed\n",
pkg,
)
}
return nil
}