made uninstalling multiple packages bearable
parent
22b29759a6
commit
e40eea198d
@ -1,25 +1,25 @@
|
|||||||
use runas::Command;
|
use runas::Command;
|
||||||
use crate::mods::strs::{err_unrec, sec, succ};
|
use crate::mods::strs::{err_unrec, sec, succ};
|
||||||
|
|
||||||
pub fn uninstall(noconfirm: bool, pkg: &str) {
|
pub fn uninstall(noconfirm: bool, pkg: Vec<String>) {
|
||||||
sec(format!("Attempting to uninstall {}", pkg));
|
sec(format!("Attempting to uninstall packages: {}", &pkg.join(" ")));
|
||||||
if noconfirm == true {
|
if noconfirm == true {
|
||||||
let result = Command::new("pacman").arg("-Rs").arg(&pkg).arg("--noconfirm").status();
|
let result = Command::new("pacman").arg("-Rs").args(&pkg).arg("--noconfirm").status();
|
||||||
match result {
|
match result {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
succ(format!("Succesfully uninstalled {}", pkg))
|
succ(format!("Succesfully uninstalled packages: {}", &pkg.join(" ")))
|
||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
err_unrec(format!("Couldn't uninstall {}", pkg))
|
err_unrec(format!("Couldn't uninstall packages: {}", &pkg.join(" ")))
|
||||||
}};
|
}};
|
||||||
} else {
|
} else {
|
||||||
let result = Command::new("pacman").arg("-Rs").arg(&pkg).status();
|
let result = Command::new("pacman").arg("-Rs").args(&pkg).status();
|
||||||
match result {
|
match result {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
succ(format!("Succesfully uninstalled {}", pkg))
|
succ(format!("Succesfully uninstalled packages: {}", &pkg.join(" ")))
|
||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
err_unrec(format!("Couldn't uninstall {}", pkg))
|
err_unrec(format!("Couldn't uninstall packages: {}", &pkg.join(" ")))
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue