Allow installing/upgrading/removing packages given as list
@@ -143,6 +143,7 @@ public class Yum {
return modified;
}
+
public GenericYumCommand install(YumPackageName... packages) {
return newYumCommand("install", packages, INSTALL_NOOP_PATTERN);
}
@@ -151,6 +152,11 @@ public class Yum {
return install(toYumPackageNameArray(package1, packages));
}
+ public GenericYumCommand install(List<String> packages) {
+ return install(packages.stream().map(YumPackageName::fromString).toArray(YumPackageName[]::new));
+ }
+
+
public GenericYumCommand upgrade(YumPackageName... packages) {
return newYumCommand("upgrade", packages, UPGRADE_NOOP_PATTERN);
}
@@ -159,6 +165,11 @@ public class Yum {
return upgrade(toYumPackageNameArray(package1, packages));
}
+ public GenericYumCommand upgrade(List<String> packages) {
+ return upgrade(packages.stream().map(YumPackageName::fromString).toArray(YumPackageName[]::new));
+ }
+
+
public GenericYumCommand remove(YumPackageName... packages) {
return newYumCommand("remove", packages, REMOVE_NOOP_PATTERN);
}
@@ -167,6 +178,10 @@ public class Yum {
return remove(toYumPackageNameArray(package1, packages));
}
+ public GenericYumCommand remove(List<String> packages) {
+ return remove(packages.stream().map(YumPackageName::fromString).toArray(YumPackageName[]::new));
+ }
+
static YumPackageName[] toYumPackageNameArray(String package1, String... packages) {
YumPackageName[] array = new YumPackageName[1 + packages.length];
array[0] = YumPackageName.fromString(package1);
@@ -176,14 +191,9 @@ public class Yum {
return array;
}
- private GenericYumCommand newYumCommand(String yumCommand,
- YumPackageName[] packages,
- Pattern noopPattern) {
- return new GenericYumCommand(
- terminal,
- yumCommand,
- List.of(packages),
- noopPattern);
+
+ private GenericYumCommand newYumCommand(String yumCommand, YumPackageName[] packages, Pattern noopPattern) {
+ return new GenericYumCommand(terminal, yumCommand, List.of(packages), noopPattern);
}
public static class GenericYumCommand {
