|
|
|
@ -1,13 +1,32 @@
|
|
|
|
|
use git2::Repository;
|
|
|
|
|
use moins::Moins;
|
|
|
|
|
use std::{env, fs, path::Path, process::Command};
|
|
|
|
|
use crate::{err_unrec, inf, inssort, mods::strs::succ, mods::strs::sec, mods::strs::prompt};
|
|
|
|
|
use crate::{err_unrec, inf, inssort, mods::strs::succ, mods::strs::sec, mods::strs::prompt, mods::uninstall::uninstall};
|
|
|
|
|
|
|
|
|
|
fn uninstall_make_depend(results: Vec<raur::Package>, pkg: &str) {
|
|
|
|
|
let aurpkgname = results[0].name.to_string(); // v here
|
|
|
|
|
let make_depends = raur::info(&[&aurpkgname]).unwrap()[0].make_depends.clone();
|
|
|
|
|
|
|
|
|
|
if make_depends.len() != 0 {
|
|
|
|
|
inf(format!("{} installed following make dependencies:", pkg));
|
|
|
|
|
for make_depend in &make_depends {
|
|
|
|
|
print!("{} ", make_depend);
|
|
|
|
|
}
|
|
|
|
|
println!("");
|
|
|
|
|
let remove = prompt(format!("Would you like to remove them?"));
|
|
|
|
|
if remove == true {
|
|
|
|
|
uninstall(true, make_depends);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
succ(format!("Succesfully installed {}", pkg));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn clone(noconfirm: bool, pkg: &str) {
|
|
|
|
|
let cachedir = format!("{}/.cache/ame", std::env::var("HOME").unwrap());
|
|
|
|
|
let path = Path::new(&cachedir);
|
|
|
|
|
let pkgdir = format!("{}/{}", &cachedir, &pkg);
|
|
|
|
|
let results = raur::search(&pkg).unwrap();
|
|
|
|
|
let mut succ_install: bool = false;
|
|
|
|
|
|
|
|
|
|
if results.len() == 0 {
|
|
|
|
|
err_unrec(format!("No matching AUR packages found"));
|
|
|
|
@ -91,7 +110,9 @@ pub fn clone(noconfirm: bool, pkg: &str) {
|
|
|
|
|
.status();
|
|
|
|
|
match install_result {
|
|
|
|
|
Ok(_) => {
|
|
|
|
|
succ(format!("Succesfully installed {}", pkg));
|
|
|
|
|
//succ(format!("Succesfully installed {}", pkg));
|
|
|
|
|
//succ_install = true;
|
|
|
|
|
uninstall_make_depend(results, pkg);
|
|
|
|
|
}
|
|
|
|
|
Err(_) => {
|
|
|
|
|
err_unrec(format!("Couldn't install {}", pkg));
|
|
|
|
@ -104,7 +125,7 @@ pub fn clone(noconfirm: bool, pkg: &str) {
|
|
|
|
|
.expect("Couldn't call makepkg");
|
|
|
|
|
match install_result.code() {
|
|
|
|
|
Some(0) => {
|
|
|
|
|
succ(format!("Succesfully installed {}", pkg));
|
|
|
|
|
uninstall_make_depend(results, pkg);
|
|
|
|
|
}
|
|
|
|
|
Some(_) => {
|
|
|
|
|
err_unrec(format!("Couldn't install {}", pkg));
|
|
|
|
|