From 57d065ec5389c92149aca3072dde08652b9bb9fa Mon Sep 17 00:00:00 2001
From: jnats
Date: Mon, 27 Sep 2021 21:47:15 +0100
Subject: [PATCH 1/6] change ver number
---
src/mods/ver.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mods/ver.rs b/src/mods/ver.rs
index abb00d1..98084b9 100644
--- a/src/mods/ver.rs
+++ b/src/mods/ver.rs
@@ -3,7 +3,7 @@ use ansi_term::Colour;
pub fn ver() {
println!("");
- inf(format!("ame - v2.1.0"));
+ inf(format!("ame - v2.1.1"));
println!("");
inf(format!("Contributors:"));
println!("- axtlos ");
From dcc630fc681f02355c4a6e36ec890c4d48d485a4 Mon Sep 17 00:00:00 2001
From: jnats
Date: Tue, 28 Sep 2021 10:27:33 +0100
Subject: [PATCH 2/6] fixed search and added secret feature
---
Cargo.toml | 3 ++-
src/mods/search.rs | 35 +++++++++++++++++++++++------------
src/mods/strs.rs | 45 +++++++++++++++++++++++++++++++++------------
src/mods/ver.rs | 2 +-
4 files changed, 59 insertions(+), 26 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index d67d99c..b60b2bf 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ame"
-version = "2.1.0"
+version = "2.1.2"
authors = [ "jnats ", "axtlos " ]
edition = "2018"
description = "a fast and efficient aur helper."
@@ -15,3 +15,4 @@ toml = "*"
serde = "*"
walkdir = "*"
ansi_term = "*"
+uwuizer = "*"
diff --git a/src/mods/search.rs b/src/mods/search.rs
index b9b4cf9..db80ad3 100644
--- a/src/mods/search.rs
+++ b/src/mods/search.rs
@@ -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"))
}};
diff --git a/src/mods/strs.rs b/src/mods/strs.rs
index 7e0fd44..bcc60a0 100644
--- a/src/mods/strs.rs
+++ b/src/mods/strs.rs
@@ -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));
+ }
}
diff --git a/src/mods/ver.rs b/src/mods/ver.rs
index 98084b9..dad46c8 100644
--- a/src/mods/ver.rs
+++ b/src/mods/ver.rs
@@ -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 ");
From ce0187759933cf2cd1e867aefec546b4f890a2c8 Mon Sep 17 00:00:00 2001
From: "jn@s"
Date: Tue, 28 Sep 2021 10:29:44 +0100
Subject: [PATCH 3/6] updated readme
---
README.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index f80ebd4..9b161cd 100644
--- a/README.md
+++ b/README.md
@@ -13,8 +13,8 @@
- Amethyst is a fast, efficient and lightweight aur helper and pacman wrapper.
-Made for crystalux, compatible with any arch-based linux distribution.
+ Amethyst is a fast, efficient and lightweight AUR helper and Pacman wrapper.
+Made for Crystal, compatible with any Arch-based Linux distribution.
![](screenshot.png)
@@ -36,7 +36,7 @@ For release:
- `make clean release`
For general debug/test:
- - `make clean debug`
+ - `make debug`
Clean all build directories:
- `make clean`
From 24c13a89bd98161cb2c642ac86aaf06b5ad70f7a Mon Sep 17 00:00:00 2001
From: jnats
Date: Tue, 28 Sep 2021 10:49:10 +0100
Subject: [PATCH 4/6] removed useless depends from cargo.toml
---
Cargo.toml | 3 ---
1 file changed, 3 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index b60b2bf..511a7cb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,8 +11,5 @@ description = "a fast and efficient aur helper."
git2 = "*"
raur = "2.0.2"
runas = "*"
-toml = "*"
-serde = "*"
-walkdir = "*"
ansi_term = "*"
uwuizer = "*"
From 9f60a04bc547f61af52b942f94d30c2cb4e472a1 Mon Sep 17 00:00:00 2001
From: jnats
Date: Tue, 28 Sep 2021 15:52:34 +0100
Subject: [PATCH 5/6] initial implementation of pacman command passthrough
---
src/main.rs | 22 +++++++++++++++++++---
src/mods/help.rs | 4 +++-
src/mods/ver.rs | 2 +-
3 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/src/main.rs b/src/main.rs
index d39a112..978310c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,6 +1,6 @@
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};
fn main() {
@@ -114,8 +114,24 @@ fn main() {
ver();
// help
- } else {
+ } else if oper == "-h" || oper == "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."))
+ }}
}
}
diff --git a/src/mods/help.rs b/src/mods/help.rs
index f6fb885..b43021a 100644
--- a/src/mods/help.rs
+++ b/src/mods/help.rs
@@ -10,7 +10,9 @@ ame -Syu(n) / upg - upgrade all packages to latest version
ame -Ss / sea - search for a package
ame -Sa / aursea - search for a package in the aur
ame -Sr / repsea - search for a package in the repos
-ame -v / ver - contributors and version info");
+ame -v / ver - contributors and version info
+
+ame - passes said flags to be processed by pacman");
println!("");
err_rec(format!("Appending 'n' where (n) is present passes '--noconfirm' to pacman. Use at your own risk."));
println!("");
diff --git a/src/mods/ver.rs b/src/mods/ver.rs
index dad46c8..757acfd 100644
--- a/src/mods/ver.rs
+++ b/src/mods/ver.rs
@@ -3,7 +3,7 @@ use ansi_term::Colour;
pub fn ver() {
println!("");
- inf(format!("ame - v2.1.2"));
+ inf(format!("ame - v2.2.0"));
println!("");
inf(format!("Contributors:"));
println!("- axtlos ");
From 8c5eadbe0d1528f8d03d5f96b8809688caf9d91c Mon Sep 17 00:00:00 2001
From: jasiosasio <54361578+jaasio@users.noreply.github.com>
Date: Fri, 1 Oct 2021 19:18:47 +0200
Subject: [PATCH 6/6] Update README.md
---
README.md | 3 +++
1 file changed, 3 insertions(+)
diff --git a/README.md b/README.md
index 9b161cd..5b9f3e4 100644
--- a/README.md
+++ b/README.md
@@ -40,3 +40,6 @@ For general debug/test:
Clean all build directories:
- `make clean`
+
+
+`echo "AME_UWU=YES" >> ~/.zshrc`, self explanatory
\ No newline at end of file