added install sorting and noconfirm
parent
afb70cbe3b
commit
12cf74ce50
@ -1,13 +1,25 @@
|
|||||||
use runas::Command;
|
use runas::Command;
|
||||||
use crate::mods::strs::{inf, err_unrec};
|
use crate::mods::strs::{inf, err_unrec};
|
||||||
|
|
||||||
pub fn install(pkg: &str) {
|
pub fn install(noconfirm: bool, pkg: &str) {
|
||||||
let result = Command::new("pacman").arg("-Sy").arg(&pkg).status();
|
let pkgs: Vec<&str> = pkg.split(" ").collect();
|
||||||
match result {
|
if noconfirm == true {
|
||||||
Ok(_) => {
|
let result = Command::new("pacman").arg("-Sy").arg("--noconfirm").args(&pkgs).status();
|
||||||
inf(format!("Succesfully installed {}", pkg))
|
match result {
|
||||||
|
Ok(_) => {
|
||||||
|
inf(format!("Succesfully installed packages: {}", pkg))
|
||||||
|
}
|
||||||
|
Err(_) => {
|
||||||
|
err_unrec(format!("Couldn't install packages: {}", pkg))
|
||||||
|
}};
|
||||||
|
} else {
|
||||||
|
let result = Command::new("pacman").arg("-Sy").args(&pkgs).status();
|
||||||
|
match result {
|
||||||
|
Ok(_) => {
|
||||||
|
inf(format!("Succesfully installed packages: {}", pkg))
|
||||||
|
}
|
||||||
|
Err(_) => {
|
||||||
|
err_unrec(format!("Couldn't install packages: {}", pkg))
|
||||||
|
}};
|
||||||
}
|
}
|
||||||
Err(_) => {
|
|
||||||
err_unrec(format!("Couldn't install {}", pkg))
|
|
||||||
}};
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,25 @@
|
|||||||
use runas::Command;
|
use runas::Command;
|
||||||
use crate::mods::strs::{inf, err_unrec};
|
use crate::mods::strs::{inf, err_unrec};
|
||||||
|
|
||||||
pub fn uninstall(pkg: &str) {
|
pub fn uninstall(noconfirm: bool, pkg: &str) {
|
||||||
inf(format!("Attempting to uninstall {}", pkg));
|
inf(format!("Attempting to uninstall {}", pkg));
|
||||||
let result = Command::new("pacman").arg("-Rs").arg(&pkg).status();
|
if noconfirm == true {
|
||||||
match result {
|
let result = Command::new("pacman").arg("-Rs").arg(&pkg).arg("--noconfirm").status();
|
||||||
Ok(_) => {
|
match result {
|
||||||
println!("")
|
Ok(_) => {
|
||||||
|
println!("")
|
||||||
|
}
|
||||||
|
Err(_) => {
|
||||||
|
err_unrec(format!("Couldn't uninstall {}", pkg))
|
||||||
|
}};
|
||||||
|
} else {
|
||||||
|
let result = Command::new("pacman").arg("-Rs").arg(&pkg).status();
|
||||||
|
match result {
|
||||||
|
Ok(_) => {
|
||||||
|
println!("")
|
||||||
|
}
|
||||||
|
Err(_) => {
|
||||||
|
err_unrec(format!("Couldn't uninstall {}", pkg))
|
||||||
|
}};
|
||||||
}
|
}
|
||||||
Err(_) => {
|
|
||||||
err_unrec(format!("Couldn't uninstall {}", pkg))
|
|
||||||
}};
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue