nix-amer/internal/instruction/ins.go

32 lines
471 B
Go
Raw Normal View History

package instruction
import (
"fmt"
"strings"
)
type install struct {
Packages []string
}
func (d *install) Build(_args string) error {
d.Packages = strings.Split(_args, " ")
return nil
}
func (d install) Exec(ctx ExecutionContext) ([]byte, error) {
// install all packages
for _, pkg := range d.Packages {
err := ctx.PackageManager.Install(pkg)
if err != nil {
return nil, fmt.Errorf("cannot install '%s' | %s", pkg, err)
}
}
return nil, nil
}