fix the testing messup i did

i18n
axtlos 3 years ago
parent 35be71e43b
commit d442a542a7

@ -15,6 +15,3 @@ ansi_term = "*"
uwuizer = "*" uwuizer = "*"
moins = "*" moins = "*"
regex = "*" regex = "*"
toml_edit = "*"
toml = "*"
bytes = "*"

@ -14,7 +14,6 @@ use mods::{
upgrade::upgrade, upgrade::upgrade,
ver::ver, ver::ver,
xargs::*, xargs::*,
database::{addPkg, remPkg}
}; };
use std::{env, process::exit, process::Command}; use std::{env, process::exit, process::Command};

@ -10,4 +10,3 @@ pub mod update;
pub mod upgrade; pub mod upgrade;
pub mod ver; pub mod ver;
pub mod xargs; pub mod xargs;
pub mod database;

@ -1,6 +1,6 @@
use crate::{ use crate::{
err_unrec, inf, inssort, mods::strs::prompt, mods::strs::sec, mods::strs::succ, err_unrec, inf, inssort, mods::strs::prompt, mods::strs::sec, mods::strs::succ,
mods::uninstall::uninstall, mods::database::addPkg mods::uninstall::uninstall,
}; };
use git2::Repository; use git2::Repository;
use moins::Moins; use moins::Moins;
@ -102,7 +102,6 @@ pub fn clone(noconfirm: bool, pkg: &str) {
match install_result { match install_result {
Ok(_) => { Ok(_) => {
uninstall_make_depend(pkg); uninstall_make_depend(pkg);
addPkg(false, pkg);
} }
Err(_) => { Err(_) => {
err_unrec(format!("Couldn't install {}", pkg)); err_unrec(format!("Couldn't install {}", pkg));
@ -118,7 +117,6 @@ pub fn clone(noconfirm: bool, pkg: &str) {
match install_result.code() { match install_result.code() {
Some(0) => { Some(0) => {
uninstall_make_depend(pkg); uninstall_make_depend(pkg);
addPkg(false, pkg);
} }
Some(_) => { Some(_) => {
err_unrec(format!("Couldn't install {}", pkg)); err_unrec(format!("Couldn't install {}", pkg));

@ -1,4 +1,4 @@
use crate::mods::{strs::{err_rec, err_unrec, sec, succ}, database::remPkg}; use crate::mods::strs::{err_rec, err_unrec, sec, succ};
use runas::Command; use runas::Command;
use std::{fs, path::Path}; use std::{fs, path::Path};
@ -15,12 +15,10 @@ pub fn uninstall(noconfirm: bool, pkgs: Vec<String>) {
.status() .status()
.expect("Couldn't call pacman"); .expect("Couldn't call pacman");
match result.code() { match result.code() {
Some(0) => { Some(0) => succ(format!(
succ(format!(
"Succesfully uninstalled packages: {}", "Succesfully uninstalled packages: {}",
&pkgs.join(" "))); &pkgs.join(" ")
remPkg(&pkgs); )),
},
Some(_) => err_rec(format!("Couldn't uninstall packages: {}", &pkgs.join(" "))), Some(_) => err_rec(format!("Couldn't uninstall packages: {}", &pkgs.join(" "))),
None => err_rec(format!("Couldn't uninstall packages: {}", &pkgs.join(" "))), None => err_rec(format!("Couldn't uninstall packages: {}", &pkgs.join(" "))),
}; };
@ -31,12 +29,10 @@ pub fn uninstall(noconfirm: bool, pkgs: Vec<String>) {
.status() .status()
.expect("Couldn't call pacman"); .expect("Couldn't call pacman");
match result.code() { match result.code() {
Some(0) => { Some(0) => succ(format!(
succ(format!(
"Succesfully uninstalled packages: {}", "Succesfully uninstalled packages: {}",
&pkgs.join(" "))); &pkgs.join(" ")
remPkg(&pkgs); )),
},
Some(_) => err_rec(format!("Couldn't uninstall packages: {}", &pkgs.join(" "))), Some(_) => err_rec(format!("Couldn't uninstall packages: {}", &pkgs.join(" "))),
None => err_rec(format!("Couldn't uninstall packages: {}", &pkgs.join(" "))), None => err_rec(format!("Couldn't uninstall packages: {}", &pkgs.join(" "))),
}; };

@ -1,16 +1,11 @@
use crate::mods::strs::{err_unrec, inf, sec, succ}; use crate::mods::strs::{err_unrec, inf, sec, succ};
use runas::Command; use runas::Command;
use std::{env, fs}; use std::{env, fs};
use toml;
pub fn upgrade(noconfirm: bool) { pub fn upgrade(noconfirm: bool) {
let homepath = std::env::var("HOME").unwrap(); let homepath = std::env::var("HOME").unwrap();
let cachedir = format!("/{}/.cache/ame/", homepath); let cachedir = format!("/{}/.cache/ame/", homepath);
let cache_exists = std::path::Path::new(&format!("/{}/.cache/ame/", homepath)).is_dir(); let cache_exists = std::path::Path::new(&format!("/{}/.cache/ame/", homepath)).is_dir();
let file = format!("{}/.local/ame/aurPkgs.db", std::env::var("HOME").unwrap());
let database = std::fs::read_to_string(&file).expect("cant open database");
let mut dbParsed = database.parse::<toml::Value>().expect("invalid Database");
if cache_exists == false { if cache_exists == false {
let cachecreate = fs::create_dir_all(&cachedir); let cachecreate = fs::create_dir_all(&cachedir);
match cachecreate { match cachecreate {
@ -45,34 +40,7 @@ pub fn upgrade(noconfirm: bool) {
}; };
} }
println!("{:?}", dbParsed); for file in std::fs::read_dir(&cachedir).unwrap() {
for entry in dbParsed.as_table() {
for (key, value) in &*entry {
//println!("{} / {}", key, value);
for (option, entry) in {
println!("{} / {}", option, entry);
}
//if key.contains("name") {
/* println!("{}",value);
let results = raur::search(format!("{}",entry["paru"]));
println!("{}",format!("{}",entry));
let mut test = value.to_string().replace("\"", "");
test = test.replace("version", "").replace("name","");
test = test.replace("=", "");
println!("{}",test.replace(" ",""));*/
//let results = raur::search(format!("{}",value));
//for res in results {
// println!("{}",&res[0].name);
//}
/*} else if key.contains("version") {
if value.as_integer() == lVersion {
println!("upgrading");
}
}*/
}
}
/*for file in std::fs::read_dir(&cachedir).unwrap() {
let dir = &file.unwrap().path(); let dir = &file.unwrap().path();
let output = std::process::Command::new("git") let output = std::process::Command::new("git")
.arg("pull") .arg("pull")
@ -114,5 +82,5 @@ pub fn upgrade(noconfirm: bool) {
None => err_unrec(format!("Couldn't install new AUR package version")), None => err_unrec(format!("Couldn't install new AUR package version")),
}; };
} }
}*/ }
} }

Loading…
Cancel
Save