fixed up user readability

i18n
jnats 3 years ago
parent ee95ec8d10
commit 5309d4347a

@ -13,5 +13,4 @@ raur = "2.0.2"
runas = "*" runas = "*"
ansi_term = "*" ansi_term = "*"
uwuizer = "*" uwuizer = "*"
text_io = "*"
moins = "*" moins = "*"

@ -4,15 +4,11 @@ use std::{env, fs, path::Path, process::Command};
use crate::{err_unrec, inf, inssort, mods::strs::succ, mods::strs::sec, mods::strs::prompt, mods::uninstall::uninstall}; 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) { fn uninstall_make_depend(results: Vec<raur::Package>, pkg: &str) {
let aurpkgname = results[0].name.to_string(); // v here let aurpkgname = results[0].name.to_string();
let make_depends = raur::info(&[&aurpkgname]).unwrap()[0].make_depends.clone(); let make_depends = raur::info(&[&aurpkgname]).unwrap()[0].make_depends.clone();
if make_depends.len() != 0 { if make_depends.len() != 0 {
inf(format!("{} installed following make dependencies:", pkg)); inf(format!("{} installed following make dependencies: {}", pkg, make_depends.join(", ")));
for make_depend in &make_depends {
print!("{} ", make_depend);
}
println!("");
let remove = prompt(format!("Would you like to remove them?")); let remove = prompt(format!("Would you like to remove them?"));
if remove == true { if remove == true {
uninstall(true, make_depends); uninstall(true, make_depends);
@ -26,7 +22,6 @@ pub fn clone(noconfirm: bool, pkg: &str) {
let path = Path::new(&cachedir); let path = Path::new(&cachedir);
let pkgdir = format!("{}/{}", &cachedir, &pkg); let pkgdir = format!("{}/{}", &cachedir, &pkg);
let results = raur::search(&pkg).unwrap(); let results = raur::search(&pkg).unwrap();
let mut succ_install: bool = false;
if results.len() == 0 { if results.len() == 0 {
err_unrec(format!("No matching AUR packages found")); err_unrec(format!("No matching AUR packages found"));
@ -110,8 +105,6 @@ pub fn clone(noconfirm: bool, pkg: &str) {
.status(); .status();
match install_result { match install_result {
Ok(_) => { Ok(_) => {
//succ(format!("Succesfully installed {}", pkg));
//succ_install = true;
uninstall_make_depend(results, pkg); uninstall_make_depend(results, pkg);
} }
Err(_) => { Err(_) => {

@ -14,7 +14,7 @@ ame -v / ver - contributors and version info
ame <any valid pacman flags> - passes said flags to be processed by pacman"); ame <any valid pacman flags> - passes said flags to be processed by pacman");
println!(""); println!("");
err_rec(format!("Appending 'n' where (n) is present passes '--noconfirm' to pacman. Use at your own risk.")); err_rec(format!("Appending 'n' where (n) is present passes '--noconfirm' to pacman. Use at your own risk. (alternatively, using '--noconfirm' as a flag works too.)"));
println!(""); println!("");
} }

@ -1,7 +1,6 @@
use ansi_term::Colour; use ansi_term::Colour;
use std::{process, env}; use std::{process, env, io, io::Write};
use uwuizer::*; use uwuizer::*;
use text_io::read;
pub fn inf(a: std::string::String){ pub fn inf(a: std::string::String){
if env::var("AME_UWU").unwrap_or("n/a".to_string()) == "YES" { if env::var("AME_UWU").unwrap_or("n/a".to_string()) == "YES" {
@ -41,23 +40,27 @@ pub fn succ(a: std::string::String) {
pub fn prompt(a: std::string::String) -> bool { pub fn prompt(a: std::string::String) -> bool {
if env::var("AME_UWU").unwrap_or("n/a".to_string()) == "YES" { if env::var("AME_UWU").unwrap_or("n/a".to_string()) == "YES" {
println!("{} {} {}", print!("{} {} {}",
Colour::Purple.bold().paint("❖"), Colour::Purple.bold().paint("❖"),
Colour::White.bold().paint(uwuize!(&a)), Colour::White.bold().paint(uwuize!(&a)),
Colour::White.bold().paint("(Y/n): ")); Colour::White.bold().paint("(Y/n): "));
let yn: String = read!(); io::stdout().flush().ok().expect("Couldn't flush stdout");
if yn == "n" || yn == "N" || yn == "no" || yn == "No" { let mut yn: String = String::new();
let _ = std::io::stdin().read_line(&mut yn);
if yn.trim() == "n" || yn.trim() == "N" || yn.trim() == "no" || yn.trim() == "No" {
false false
} else { } else {
true true
} }
} else { } else {
println!("{} {} {}", print!("{} {} {}",
Colour::Purple.bold().paint("❖"), Colour::Purple.bold().paint("❖"),
Colour::White.bold().paint(&a), Colour::White.bold().paint(&a),
Colour::White.bold().paint("(Y/n): ")); Colour::White.bold().paint("(Y/n): "));
let yn: String = read!(); io::stdout().flush().ok().expect("Couldn't flush stdout");
if yn == "n" || yn == "N" || yn == "no" || yn == "No" { let mut yn: String = String::new();
let _ = std::io::stdin().read_line(&mut yn);
if yn.trim() == "n" || yn.trim() == "N" || yn.trim() == "no" || yn.trim() == "No" {
false false
} else { } else {
true true

Loading…
Cancel
Save