Skip to content

Commit 9637e89

Browse files
committed
Added Install command
1 parent 0219c24 commit 9637e89

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Diff for: apt.go

+13
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,16 @@ func Remove(packs ...*Package) (output []byte, err error) {
124124
cmd := exec.Command("apt-get", args...)
125125
return cmd.CombinedOutput()
126126
}
127+
128+
// Install installs a set of packages
129+
func Install(packs ...*Package) (output []byte, err error) {
130+
args := []string{"install", "-y"}
131+
for _, pack := range packs {
132+
if pack == nil || pack.Name == "" {
133+
return nil, fmt.Errorf("apt.Install: Invalid package with empty Name")
134+
}
135+
args = append(args, pack.Name)
136+
}
137+
cmd := exec.Command("apt-get", args...)
138+
return cmd.CombinedOutput()
139+
}

0 commit comments

Comments
 (0)