fixed search and added secret feature

i18n
jnats 3 years ago
parent 57d065ec53
commit dcc630fc68

@ -1,6 +1,6 @@
[package]
name = "ame"
version = "2.1.0"
version = "2.1.2"
authors = [ "jnats <jnats@salyut.one>", "axtlos <axtlos@salyut.one>" ]
edition = "2018"
description = "a fast and efficient aur helper."
@ -15,3 +15,4 @@ toml = "*"
serde = "*"
walkdir = "*"
ansi_term = "*"
uwuizer = "*"

@ -1,17 +1,21 @@
use std::{ops::Deref, process::Command};
use crate::mods::strs::{err_unrec, inf};
use ansi_term::Colour;
use crate::mods::strs::{err_unrec, err_rec, inf};
pub fn a_search(pkg: &str) {
let results = raur::search(&pkg);
for res in &results {
if res.len() <= 1 {
err_unrec(format!("No matching packages found"));
for r in &results {
if r.len() == 0 {
err_rec(format!("No matching AUR packages found"));
}
for res in r {
println!("{}{} {}\n {}",
Colour::Cyan.bold().paint("aur/"),
Colour::White.bold().paint(&res.name),
Colour::Green.bold().paint(&res.version),
Colour::White.paint(res.description.as_ref().map_or("n/a", String::deref)));
}
println!("aur/{} {}\n {}",
res[0].name,
res[0].version,
res[0].description.as_ref().map_or("n/a", String::deref));
}
}
@ -19,12 +23,19 @@ pub fn r_search(pkg: &str) {
let result = Command::new("pacman")
.arg("-Ss")
.arg(&pkg)
.status();
match result {
Ok(_) => {
.status()
.unwrap();
match result.code() {
Some(0) => {
inf(format!("Repo search successful"))
}
Err(_) => {
Some(1) => {
err_rec(format!("No matching repo packages found"))
}
Some(_) => {
err_unrec(format!("Someting went terribly wrong"))
}
None => {
err_unrec(format!("Couldn't search pacman repos"))
}};

@ -1,24 +1,45 @@
use ansi_term::Colour;
use std::process;
use std::{process, env};
use uwuizer::*;
pub fn inf(a: std::string::String){
println!("{} {}",
Colour::Purple.bold().paint("❖"),
Colour::White.bold().paint(a));
if env::var("AME_UWU").unwrap_or("n/a".to_string()) == "YES" {
println!("{} {}",
Colour::Purple.bold().paint("❖"),
Colour::White.bold().paint(uwuize!(&a)));
} else {
println!("{} {}",
Colour::Purple.bold().paint("❖"),
Colour::White.bold().paint(a));
}
}
pub fn err_unrec(a: std::string::String) {
println!("{} {} {}",
Colour::Red.bold().paint("✖ Unrecoverable error:"),
Colour::Red.paint(a),
Colour::Red.bold().paint("Terminating."));
process::exit(1);
if env::var("AME_UWU").unwrap_or("n/a".to_string()) == "YES" {
println!("{} {} {}",
Colour::Red.bold().paint(uwuize!("✖ Unrecoverable error:")),
Colour::Red.paint(uwuize!(&a)),
Colour::Red.bold().paint(uwuize!("Terminating.")));
process::exit(1);
} else {
println!("{} {} {}",
Colour::Red.bold().paint("✖ Unrecoverable error:"),
Colour::Red.paint(a),
Colour::Red.bold().paint("Terminating."));
process::exit(1);
}
}
// we havent actually used this one yet
pub fn err_rec(a: std::string::String) {
println!("{} {}",
Colour::Yellow.bold().paint("⚠ WARNING:"),
Colour::Yellow.paint(a));
if env::var("AME_UWU").unwrap_or("n/a".to_string()) == "YES" {
println!("{} {}",
Colour::Yellow.bold().paint(uwuize!("⚠ WARNING:")),
Colour::Yellow.paint(uwuize!(&a)));
} else {
println!("{} {}",
Colour::Yellow.bold().paint("⚠ WARNING:"),
Colour::Yellow.paint(a));
}
}

@ -3,7 +3,7 @@ use ansi_term::Colour;
pub fn ver() {
println!("");
inf(format!("ame - v2.1.1"));
inf(format!("ame - v2.1.2"));
println!("");
inf(format!("Contributors:"));
println!("- axtlos <axtlos@salyut.one>");

Loading…
Cancel
Save