rustfmt
parent
5309d4347a
commit
fd6a008efb
@ -1,12 +1,12 @@
|
|||||||
pub mod clearcache;
|
pub mod clearcache;
|
||||||
pub mod clone;
|
pub mod clone;
|
||||||
pub mod help;
|
pub mod help;
|
||||||
|
pub mod inssort;
|
||||||
pub mod install;
|
pub mod install;
|
||||||
pub mod search;
|
pub mod search;
|
||||||
|
pub mod strs;
|
||||||
pub mod uninstall;
|
pub mod uninstall;
|
||||||
pub mod upgrade;
|
|
||||||
pub mod update;
|
pub mod update;
|
||||||
pub mod strs;
|
pub mod upgrade;
|
||||||
pub mod ver;
|
pub mod ver;
|
||||||
pub mod inssort;
|
|
||||||
pub mod xargs;
|
pub mod xargs;
|
||||||
|
@ -1,31 +1,30 @@
|
|||||||
use runas::Command;
|
|
||||||
use crate::mods::strs::{err_unrec, succ};
|
use crate::mods::strs::{err_unrec, succ};
|
||||||
|
use runas::Command;
|
||||||
|
|
||||||
pub fn install(noconfirm: bool, pkg: &str) {
|
pub fn install(noconfirm: bool, pkg: &str) {
|
||||||
let pkgs: Vec<&str> = pkg.split(" ").collect();
|
let pkgs: Vec<&str> = pkg.split(" ").collect();
|
||||||
if noconfirm == true {
|
if noconfirm == true {
|
||||||
let result = Command::new("pacman").arg("-Sy").arg("--noconfirm").args(&pkgs).status().expect("Couldn't call pacman");
|
let result = Command::new("pacman")
|
||||||
|
.arg("-Sy")
|
||||||
|
.arg("--noconfirm")
|
||||||
|
.args(&pkgs)
|
||||||
|
.status()
|
||||||
|
.expect("Couldn't call pacman");
|
||||||
match result.code() {
|
match result.code() {
|
||||||
Some(0) => {
|
Some(0) => succ(format!("Succesfully installed packages: {}", pkg)),
|
||||||
succ(format!("Succesfully installed packages: {}", pkg))
|
Some(_) => err_unrec(format!("Couldn't install packages: {}", pkg)),
|
||||||
}
|
None => err_unrec(format!("Couldn't install packages: {}", pkg)),
|
||||||
Some(_) => {
|
};
|
||||||
err_unrec(format!("Couldn't install packages: {}", pkg))
|
|
||||||
}
|
|
||||||
None => {
|
|
||||||
err_unrec(format!("Couldn't install packages: {}", pkg))
|
|
||||||
}};
|
|
||||||
} else {
|
} else {
|
||||||
let result = Command::new("pacman").arg("-Sy").args(&pkgs).status().expect("Couldn't call pacman");
|
let result = Command::new("pacman")
|
||||||
|
.arg("-Sy")
|
||||||
|
.args(&pkgs)
|
||||||
|
.status()
|
||||||
|
.expect("Couldn't call pacman");
|
||||||
match result.code() {
|
match result.code() {
|
||||||
Some(0) => {
|
Some(0) => succ(format!("Succesfully installed packages: {}", pkg)),
|
||||||
succ(format!("Succesfully installed packages: {}", pkg))
|
Some(_) => err_unrec(format!("Couldn't install packages: {}", pkg)),
|
||||||
}
|
None => err_unrec(format!("Couldn't install packages: {}", pkg)),
|
||||||
Some(_) => {
|
};
|
||||||
err_unrec(format!("Couldn't install packages: {}", pkg))
|
|
||||||
}
|
|
||||||
None => {
|
|
||||||
err_unrec(format!("Couldn't install packages: {}", pkg))
|
|
||||||
}};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue