Merge branch 'main' of https://github.com/crystal-linux/ame into main

i18n
jasiosasio 3 years ago
commit 53e8857ad4

@ -1,6 +1,6 @@
[package] [package]
name = "ame" name = "ame"
version = "2.1.0" version = "2.1.2"
authors = [ "jnats <jnats@salyut.one>", "axtlos <axtlos@salyut.one>" ] authors = [ "jnats <jnats@salyut.one>", "axtlos <axtlos@salyut.one>" ]
edition = "2018" edition = "2018"
description = "a fast and efficient aur helper." description = "a fast and efficient aur helper."
@ -11,7 +11,5 @@ description = "a fast and efficient aur helper."
git2 = "*" git2 = "*"
raur = "2.0.2" raur = "2.0.2"
runas = "*" runas = "*"
toml = "*"
serde = "*"
walkdir = "*"
ansi_term = "*" ansi_term = "*"
uwuizer = "*"

@ -13,8 +13,8 @@
<img src=https://img.shields.io/github/issues-pr/crystal-linux/ame?style=flat&color=a900f&logo=Github /> <img src=https://img.shields.io/github/issues-pr/crystal-linux/ame?style=flat&color=a900f&logo=Github />
<a href="https://discord.gg/yp4xpZeAgW"><img alt="Discord" src="https://img.shields.io/discord/825473796227858482?color=blue&label=Discord&logo=Discord&logoColor=white"?link=https://discord.gg/yp4xpZeAgW&link=https://discord.gg/yp4xpZeAgW> </p></a> <a href="https://discord.gg/yp4xpZeAgW"><img alt="Discord" src="https://img.shields.io/discord/825473796227858482?color=blue&label=Discord&logo=Discord&logoColor=white"?link=https://discord.gg/yp4xpZeAgW&link=https://discord.gg/yp4xpZeAgW> </p></a>
<p align="center"> Amethyst is a fast, efficient and lightweight aur helper and pacman wrapper. <p align="center"> Amethyst is a fast, efficient and lightweight AUR helper and Pacman wrapper.
Made for crystalux, compatible with any arch-based linux distribution.</p> Made for Crystal, compatible with any Arch-based Linux distribution.</p>
![](screenshot.png) ![](screenshot.png)
@ -36,7 +36,10 @@ For release:
- `make clean release` - `make clean release`
For general debug/test: For general debug/test:
- `make clean debug` - `make debug`
Clean all build directories: Clean all build directories:
- `make clean` - `make clean`
`echo "AME_UWU=YES" >> ~/.zshrc`, self explanatory

@ -1,6 +1,6 @@
mod mods; mod mods;
use mods::{clearcache::clearcache, clone::clone, help::help, install::install, search::{a_search, r_search}, uninstall::uninstall, upgrade::upgrade, update::update, ver::ver, strs::inf, strs::err_unrec}; use mods::{clearcache::clearcache, clone::clone, help::help, install::install, search::{a_search, r_search}, uninstall::uninstall, upgrade::upgrade, update::update, ver::ver, strs::inf, strs::err_unrec, strs::err_rec};
use std::{env, process::exit, process::Command, process::Stdio}; use std::{env, process::exit, process::Command, process::Stdio};
fn main() { fn main() {
@ -114,8 +114,24 @@ fn main() {
ver(); ver();
// help // help
} else { } else if oper == "-h" || oper == "help" {
help(); help();
exit(0);
// pacman passthrough
} else {
let pass = Command::new("pacman")
.args(env::args().skip(1))
.status()
.expect("Something has gone wrong.");
match pass.code() {
Some(1) => {
err_rec(format!("No such operation \"{}\"", args.join(" ")));
inf(format!("Try running \"ame help\" for an overview of how to use ame"))
}
Some(_) => {}
None => {
err_unrec(format!("Something has gone terribly wrong."))
}}
} }
} }

@ -10,7 +10,9 @@ ame -Syu(n) / upg - upgrade all packages to latest version
ame -Ss / sea <pkg> - search for a package ame -Ss / sea <pkg> - search for a package
ame -Sa / aursea <pkg> - search for a package in the aur ame -Sa / aursea <pkg> - search for a package in the aur
ame -Sr / repsea <pkg> - search for a package in the repos ame -Sr / repsea <pkg> - search for a package in the repos
ame -v / ver - contributors and version info"); ame -v / ver - contributors and version info
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."));
println!(""); println!("");

@ -1,17 +1,21 @@
use std::{ops::Deref, process::Command}; 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) { pub fn a_search(pkg: &str) {
let results = raur::search(&pkg); let results = raur::search(&pkg);
for res in &results { for r in &results {
if res.len() <= 1 { if r.len() == 0 {
err_unrec(format!("No matching packages found")); 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") let result = Command::new("pacman")
.arg("-Ss") .arg("-Ss")
.arg(&pkg) .arg(&pkg)
.status(); .status()
match result { .unwrap();
Ok(_) => { match result.code() {
Some(0) => {
inf(format!("Repo search successful")) 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")) err_unrec(format!("Couldn't search pacman repos"))
}}; }};

@ -1,24 +1,45 @@
use ansi_term::Colour; use ansi_term::Colour;
use std::process; use std::{process, env};
use uwuizer::*;
pub fn inf(a: std::string::String){ pub fn inf(a: std::string::String){
println!("{} {}", if env::var("AME_UWU").unwrap_or("n/a".to_string()) == "YES" {
Colour::Purple.bold().paint("❖"), println!("{} {}",
Colour::White.bold().paint(a)); 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) { pub fn err_unrec(a: std::string::String) {
println!("{} {} {}", if env::var("AME_UWU").unwrap_or("n/a".to_string()) == "YES" {
Colour::Red.bold().paint("✖ Unrecoverable error:"), println!("{} {} {}",
Colour::Red.paint(a), Colour::Red.bold().paint(uwuize!("✖ Unrecoverable error:")),
Colour::Red.bold().paint("Terminating.")); Colour::Red.paint(uwuize!(&a)),
process::exit(1); 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 // we havent actually used this one yet
pub fn err_rec(a: std::string::String) { pub fn err_rec(a: std::string::String) {
println!("{} {}", if env::var("AME_UWU").unwrap_or("n/a".to_string()) == "YES" {
Colour::Yellow.bold().paint("⚠ WARNING:"), println!("{} {}",
Colour::Yellow.paint(a)); 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() { pub fn ver() {
println!(""); println!("");
inf(format!("ame - v2.1.0")); inf(format!("ame - v2.2.0"));
println!(""); println!("");
inf(format!("Contributors:")); inf(format!("Contributors:"));
println!("- axtlos <axtlos@salyut.one>"); println!("- axtlos <axtlos@salyut.one>");

Loading…
Cancel
Save