From 9537dee2539f17bca52bc328b53a034d8dbf1d1e Mon Sep 17 00:00:00 2001 From: Amy Date: Tue, 14 Dec 2021 20:53:22 +0100 Subject: [PATCH] doesnt randomly error even if package is not in overrides and prints proper package when adding to database --- src/mods/database.rs | 6 +++--- src/mods/uninstall.rs | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mods/database.rs b/src/mods/database.rs index 2b576a0..53f5715 100644 --- a/src/mods/database.rs +++ b/src/mods/database.rs @@ -100,7 +100,7 @@ pub fn add_pkg(from_repo: bool, pkgs: &[&str]) { package_name = res.name.clone(); package_version = res.version.clone(); } - if !from_repo { + if !from_repo{ let result = connection.execute(format!( " INSERT INTO pkgs (name, version) VALUES (\"{}\", \"{}\"); @@ -119,8 +119,8 @@ pub fn add_pkg(from_repo: bool, pkgs: &[&str]) { pkg, "from_repo" )); match result { - Ok(_) => inf(format!("Added {} to database", package_name)), - Err(_) => err_unrec(format!("Couldn't add {} to database", package_name)), + Ok(_) => inf(format!("Added {} to database", pkg)), + Err(_) => err_unrec(format!("Couldn't add {} to database", pkg)), } } } diff --git a/src/mods/uninstall.rs b/src/mods/uninstall.rs index 0122ac2..6b04845 100644 --- a/src/mods/uninstall.rs +++ b/src/mods/uninstall.rs @@ -46,7 +46,9 @@ pub fn uninstall(noconfirm: bool, pkgs: Vec) { } } } - err_unrec(format!("The action you called for tries to uninstall packages: {} . This is disallowed by default as these are important system packages. If you fully know what you are doing and would like to uninstall these, please create an override in /etc/ame/overrides.conf.", matches.join(" "))); + if !matches.is_empty() { + err_unrec(format!("The action you called for tries to uninstall packages: {} . This is disallowed by default as these are important system packages. If you fully know what you are doing and would like to uninstall these, please create an override in /etc/ame/overrides.conf.", matches.join(" "))); + } if noconfirm { let result = Command::new("pacman")