From 041f8e21b2068a16314d22aa9c164ee891be6cbb Mon Sep 17 00:00:00 2001 From: michal Date: Thu, 20 Jan 2022 17:41:28 +0000 Subject: [PATCH] replaced panic! and eprintln! with crash! and log! reworked pkg-warner slightly --- Cargo.toml | 20 +++++++++------ src/{warn.rs => bin/apt-get.rs} | 0 src/bin/apt.rs | 14 +++++++++++ src/bin/dnf.rs | 14 +++++++++++ src/bin/eopkg.rs | 14 +++++++++++ src/bin/yum.rs | 14 +++++++++++ src/bin/zypper.rs | 14 +++++++++++ src/database/add.rs | 7 +++--- src/database/initialise.rs | 9 ++++--- src/database/query.rs | 10 ++++---- src/database/remove.rs | 4 +-- src/internal/clean.rs | 18 +++----------- src/internal/initialise.rs | 15 +++++++++--- src/internal/mod.rs | 4 +++ src/internal/rpc.rs | 12 ++++----- src/internal/sort.rs | 21 +++++----------- src/internal/strings.rs | 12 +++++++++ src/main.rs | 8 +++--- src/operations/aur_install.rs | 43 +++++++++++++++------------------ src/operations/install.rs | 21 ++++++---------- src/operations/search.rs | 11 ++++++--- src/operations/uninstall.rs | 23 ++++++------------ src/operations/upgrade.rs | 6 ++--- 23 files changed, 189 insertions(+), 125 deletions(-) rename src/{warn.rs => bin/apt-get.rs} (100%) create mode 100644 src/bin/apt.rs create mode 100644 src/bin/dnf.rs create mode 100644 src/bin/eopkg.rs create mode 100644 src/bin/yum.rs create mode 100644 src/bin/zypper.rs diff --git a/Cargo.toml b/Cargo.toml index 5213662..e34d3d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,27 +15,32 @@ pkg-warner = [] [[bin]] name = "apt" -path = "src/warn.rs" +path = "src/bin/apt.rs" required-features = [ "pkg-warner" ] [[bin]] name = "apt-get" -path = "src/warn.rs" +path = "src/bin/apt-get.rs" required-features = [ "pkg-warner" ] [[bin]] name = "dnf" -path = "src/warn.rs" +path = "src/bin/dnf.rs" +required-features = [ "pkg-warner" ] + +[[bin]] +name = "eopkg" +path = "src/bin/eopkg.rs" required-features = [ "pkg-warner" ] [[bin]] name = "yum" -path = "src/warn.rs" +path = "src/bin/yum.rs" required-features = [ "pkg-warner" ] [[bin]] name = "zypper" -path = "src/warn.rs" +path = "src/bin/zypper.rs" required-features = [ "pkg-warner" ] [profile.release] @@ -50,6 +55,5 @@ clap = { version = "2.34.0", default-features = false, features = [ "suggestions regex = { version = "1.5.4", default-features = false, features = [ "std", "unicode-perl" ] } runas = "0.2.1" rusqlite = { version = "0.26.3", default-features = false } -reqwest = { version = "0.11.7", default-features = false, features = [ "blocking", "json", "default-tls" ] } -serde = { version = "1.0.90", default-features = false, features = [ "derive", "serde_derive" ] } -throbber = { version = "0.1.4", default-features = false } \ No newline at end of file +ureq = { version = "2.4.0", default-features = false, features = [ "native-tls", "json" ] } +serde = { version = "1.0.90", default-features = false, features = [ "derive", "serde_derive" ] } \ No newline at end of file diff --git a/src/warn.rs b/src/bin/apt-get.rs similarity index 100% rename from src/warn.rs rename to src/bin/apt-get.rs diff --git a/src/bin/apt.rs b/src/bin/apt.rs new file mode 100644 index 0000000..db60a1d --- /dev/null +++ b/src/bin/apt.rs @@ -0,0 +1,14 @@ +use std::env; + +fn main() { + let arg = &env::args().collect::>()[0]; + + println!( + "Sorry for the bother, we don't use \x1b[2;22;35m{}\x1b[0m on Crystal, we use \x1b[2;22;35mame\x1b[0m! Please use that instead!", + arg.split('/') + .collect::>() + .last() + .unwrap() + ); + std::process::exit(0); +} diff --git a/src/bin/dnf.rs b/src/bin/dnf.rs new file mode 100644 index 0000000..db60a1d --- /dev/null +++ b/src/bin/dnf.rs @@ -0,0 +1,14 @@ +use std::env; + +fn main() { + let arg = &env::args().collect::>()[0]; + + println!( + "Sorry for the bother, we don't use \x1b[2;22;35m{}\x1b[0m on Crystal, we use \x1b[2;22;35mame\x1b[0m! Please use that instead!", + arg.split('/') + .collect::>() + .last() + .unwrap() + ); + std::process::exit(0); +} diff --git a/src/bin/eopkg.rs b/src/bin/eopkg.rs new file mode 100644 index 0000000..db60a1d --- /dev/null +++ b/src/bin/eopkg.rs @@ -0,0 +1,14 @@ +use std::env; + +fn main() { + let arg = &env::args().collect::>()[0]; + + println!( + "Sorry for the bother, we don't use \x1b[2;22;35m{}\x1b[0m on Crystal, we use \x1b[2;22;35mame\x1b[0m! Please use that instead!", + arg.split('/') + .collect::>() + .last() + .unwrap() + ); + std::process::exit(0); +} diff --git a/src/bin/yum.rs b/src/bin/yum.rs new file mode 100644 index 0000000..db60a1d --- /dev/null +++ b/src/bin/yum.rs @@ -0,0 +1,14 @@ +use std::env; + +fn main() { + let arg = &env::args().collect::>()[0]; + + println!( + "Sorry for the bother, we don't use \x1b[2;22;35m{}\x1b[0m on Crystal, we use \x1b[2;22;35mame\x1b[0m! Please use that instead!", + arg.split('/') + .collect::>() + .last() + .unwrap() + ); + std::process::exit(0); +} diff --git a/src/bin/zypper.rs b/src/bin/zypper.rs new file mode 100644 index 0000000..db60a1d --- /dev/null +++ b/src/bin/zypper.rs @@ -0,0 +1,14 @@ +use std::env; + +fn main() { + let arg = &env::args().collect::>()[0]; + + println!( + "Sorry for the bother, we don't use \x1b[2;22;35m{}\x1b[0m on Crystal, we use \x1b[2;22;35mame\x1b[0m! Please use that instead!", + arg.split('/') + .collect::>() + .last() + .unwrap() + ); + std::process::exit(0); +} diff --git a/src/database/add.rs b/src/database/add.rs index cfbcecd..8b1497d 100644 --- a/src/database/add.rs +++ b/src/database/add.rs @@ -1,5 +1,5 @@ use crate::internal::rpc::Package; -use crate::Options; +use crate::{crash, log, Options}; use rusqlite::Connection; use std::env; use std::path::Path; @@ -12,12 +12,13 @@ pub fn add(pkg: Package, options: Options) { .expect("Couldn't connect to database"); if options.verbosity >= 1 { - eprintln!("Adding package {} to database", pkg.name); + log(format!("Adding package {} to database", pkg.name)); } conn.execute("INSERT OR REPLACE INTO packages (name, version, description, depends, make_depends) VALUES (?1, ?2, ?3, ?4, ?5)", [&pkg.name, &pkg.version, &pkg.description.unwrap_or_else(|| "No description found.".parse().unwrap()), &pkg.depends.join(" "), &pkg.make_depends.join(" ")] ).unwrap_or_else(|e| { - panic!("Failed adding package {} to the database: {}", pkg.name, e); + crash(format!("Failed adding package {} to the database: {}", pkg.name, e), 1); + 1 }); } diff --git a/src/database/initialise.rs b/src/database/initialise.rs index 73a0e79..8eac1b2 100644 --- a/src/database/initialise.rs +++ b/src/database/initialise.rs @@ -1,4 +1,4 @@ -use crate::Options; +use crate::{crash, log, Options}; use rusqlite::Connection; use std::env; use std::path::Path; @@ -9,14 +9,14 @@ pub fn init(options: Options) { let verbosity = options.verbosity; if verbosity >= 1 { - eprintln!("Creating database at {}", &path); + log(format!("Creating database at {}", &path)); } let conn = Connection::open(dbpath).expect("Couldn't create database at ~/.local/share/ame/db.sqlite"); if verbosity >= 1 { - eprintln!("Populating database with table") + log("Populating database with table".to_string()); } conn.execute( @@ -30,6 +30,7 @@ pub fn init(options: Options) { [], ) .unwrap_or_else(|e| { - panic!("Couldn't initialise database: {}", e); + crash(format!("Couldn't initialise database: {}", e), 1); + 1 }); } diff --git a/src/database/query.rs b/src/database/query.rs index 1cddbdc..a9289df 100644 --- a/src/database/query.rs +++ b/src/database/query.rs @@ -1,5 +1,5 @@ use crate::internal::rpc::Package; -use crate::Options; +use crate::{log, Options}; use rusqlite::Connection; use std::env; use std::path::Path; @@ -8,7 +8,7 @@ pub fn query(a: &str, options: Options) -> Vec { let verbosity = options.verbosity; if verbosity >= 1 { - eprintln!("Connecting to database"); + log("Connecting to database".to_string()); } let conn = Connection::open(Path::new(&format!( @@ -18,7 +18,7 @@ pub fn query(a: &str, options: Options) -> Vec { .expect("Couldn't connect to database"); if verbosity >= 1 { - eprintln!("Querying database for input") + log("Querying database for input".to_string()); } let mut rs = conn @@ -47,7 +47,7 @@ pub fn query(a: &str, options: Options) -> Vec { .expect("Couldn't query database for packages"); if verbosity >= 1 { - eprintln!("Retrieved results"); + log("Retrieved results".to_string()); } let mut results: Vec = vec![]; @@ -57,7 +57,7 @@ pub fn query(a: &str, options: Options) -> Vec { } if verbosity >= 1 { - eprintln!("Collected results") + log("Collected results".to_string()); } results diff --git a/src/database/remove.rs b/src/database/remove.rs index a189e40..bb7a5ab 100644 --- a/src/database/remove.rs +++ b/src/database/remove.rs @@ -1,4 +1,4 @@ -use crate::Options; +use crate::{log, Options}; use rusqlite::Connection; use std::env; use std::path::Path; @@ -13,7 +13,7 @@ pub fn remove(pkg: &str, options: Options) { let verbosity = options.verbosity; if verbosity >= 1 { - eprintln!("Removing package {} from database", pkg); + log(format!("Removing package {} from database", pkg)); } conn.execute( diff --git a/src/internal/clean.rs b/src/internal/clean.rs index a6bf46a..ee20893 100644 --- a/src/internal/clean.rs +++ b/src/internal/clean.rs @@ -1,3 +1,4 @@ +use crate::internal::strings::log; use crate::Options; use regex::Regex; @@ -15,21 +16,8 @@ pub fn clean(a: &[String], options: Options) -> Vec { } } - match verbosity { - 0 => {} - 1 => { - eprintln!("Cleaned: {:?}\nInto: {:?}", a, cleaned); - } - _ => { - eprintln!("Cleaned:"); - for b in a { - eprintln!("{}", b); - } - eprintln!("Into:"); - for c in &cleaned { - eprintln!("{}", c); - } - } + if verbosity >= 1 { + log(format!("Cleaned: {:?}\nInto: {:?}", a, cleaned)); } cleaned diff --git a/src/internal/initialise.rs b/src/internal/initialise.rs index 8e6d355..5e8b071 100644 --- a/src/internal/initialise.rs +++ b/src/internal/initialise.rs @@ -1,3 +1,4 @@ +use crate::internal::strings::{crash, log}; use crate::Options; use std::env; use std::path::Path; @@ -11,11 +12,14 @@ pub fn init(options: Options) { match r { Ok(_) => { if verbosity >= 1 { - eprintln!("Created path: {}/.local/share/ame", homedir); + log(format!("Created path: {}/.local/share/ame", homedir)); } } Err(e) => { - panic!("Couldn't create path: {}/.local/share/ame: {}", homedir, e); + crash( + format!("Couldn't create path: {}/.local/share/ame: {}", homedir, e), + 1, + ); } } } @@ -29,11 +33,14 @@ pub fn init(options: Options) { match r { Ok(_) => { if verbosity >= 1 { - eprintln!("Created path: {}/.cache/ame", homedir); + log(format!("Created path: {}/.cache/ame", homedir)); } } Err(e) => { - panic!("Couldn't create path: {}/.cache/ame: {}", homedir, e); + crash( + format!("Couldn't create path: {}/.cache/ame: {}", homedir, e), + 1, + ); } } } diff --git a/src/internal/mod.rs b/src/internal/mod.rs index d642b4a..1965fd1 100644 --- a/src/internal/mod.rs +++ b/src/internal/mod.rs @@ -26,3 +26,7 @@ pub fn info(a: String) { pub fn crash(a: String, b: i32) { strings::crash(a, b); } + +pub fn log(a: String) { + strings::log(a); +} diff --git a/src/internal/rpc.rs b/src/internal/rpc.rs index 01e1aa9..d578113 100644 --- a/src/internal/rpc.rs +++ b/src/internal/rpc.rs @@ -1,5 +1,3 @@ -#![allow(dead_code)] - #[derive(serde::Deserialize, Debug, Clone)] pub struct Package { #[serde(rename = "Name")] @@ -31,12 +29,13 @@ pub struct InfoResults { pub const URL: &str = "https://aur.archlinux.org/"; pub fn rpcinfo(pkg: String) -> InfoResults { - let res = reqwest::blocking::get(&format!( + let res: SearchResults = ureq::get(&format!( "https://aur.archlinux.org/rpc/?v=5&type=info&arg={}", pkg )) + .call() .unwrap() - .json::() + .into_json() .unwrap(); if res.results.is_empty() { @@ -53,11 +52,12 @@ pub fn rpcinfo(pkg: String) -> InfoResults { } pub fn rpcsearch(pkg: String) -> SearchResults { - reqwest::blocking::get(&format!( + ureq::get(&format!( "https://aur.archlinux.org/rpc/?v=5&type=search&arg={}", pkg )) + .call() .unwrap() - .json() + .into_json::() .unwrap() } diff --git a/src/internal/sort.rs b/src/internal/sort.rs index 71a9966..977d5cd 100644 --- a/src/internal/sort.rs +++ b/src/internal/sort.rs @@ -1,3 +1,4 @@ +use crate::internal::strings::log; use crate::internal::{clean, rpc, structs}; use crate::Options; use std::process::{Command, Stdio}; @@ -10,18 +11,8 @@ pub fn sort(input: &[String], options: Options) -> structs::Sorted { let a = clean(input, options); - match verbosity { - 0 => {} - 1 => { - eprintln!("Sorting:"); - eprintln!("{:?}", a); - } - _ => { - eprintln!("Sorting:"); - for b in &a { - eprintln!("{}", b); - } - } + if verbosity >= 1 { + log(format!("Sorting: {:?}", a.join(" "))); } for b in a { @@ -34,17 +25,17 @@ pub fn sort(input: &[String], options: Options) -> structs::Sorted { if rpc::rpcinfo(b.to_string()).found { if verbosity >= 1 { - eprintln!("{} found in AUR", b); + log(format!("{} found in AUR", b)); } aur.push(b.to_string()); } else if let Some(0) = rs.code() { if verbosity >= 1 { - eprintln!("{} found in repos", b) + log(format!("{} found in repos", b)); } repo.push(b.to_string()); } else { if verbosity >= 1 { - eprintln!("{} not found", b); + log(format!("{} not found", b)); } nf.push(b.to_string()); } diff --git a/src/internal/strings.rs b/src/internal/strings.rs index 417dbe8..29f03e4 100644 --- a/src/internal/strings.rs +++ b/src/internal/strings.rs @@ -1,4 +1,5 @@ use std::process::exit; +use std::time::UNIX_EPOCH; pub fn info(a: String) { println!("\x1b[2;22;35m❖\x1b[0m \x1b[1;37m{}\x1b[0m", a) @@ -8,3 +9,14 @@ pub fn crash(a: String, b: i32) { println!("\x1b[2;22;31m❌\x1b[0m \x1b[1;91m{}\x1b[0m", a); exit(b); } + +pub fn log(a: String) { + eprintln!( + "{} {}", + std::time::SystemTime::now() + .duration_since(UNIX_EPOCH) + .unwrap() + .as_secs(), + a + ); +} diff --git a/src/main.rs b/src/main.rs index b6a10ff..1999d6b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,7 +5,7 @@ mod database; mod internal; mod operations; -use crate::internal::{info, init, sort, structs::Options}; +use crate::internal::{crash, info, init, log, sort, structs::Options}; use clap::{App, AppSettings, Arg, ArgMatches, ArgSettings, Shell, SubCommand}; use std::io; use std::process::exit; @@ -16,7 +16,7 @@ fn main() { } if unsafe { geteuid() } == 0 { - panic!("Running amethyst as root is disallowed as it can lead to system breakage. Instead, amethyst will prompt you when it needs superuser permissions") + crash("Running amethyst as root is disallowed as it can lead to system breakage. Instead, amethyst will prompt you when it needs superuser permissions".to_string(), 1); } fn build_app() -> App<'static, 'static> { @@ -152,10 +152,10 @@ fn main() { operations::aur_install(sorted.aur, options); } if !sorted.nf.is_empty() { - eprintln!( + log(format!( "Couldn't find packages: {} in repos or the AUR", sorted.nf.join(", ") - ); + )); } exit(0); } diff --git a/src/operations/aur_install.rs b/src/operations/aur_install.rs index c3bc172..a5f7b72 100644 --- a/src/operations/aur_install.rs +++ b/src/operations/aur_install.rs @@ -1,6 +1,6 @@ use crate::internal::crash; use crate::internal::rpc::rpcinfo; -use crate::{info, Options}; +use crate::{info, log, Options}; use std::env; use std::env::set_current_dir; use std::fs::remove_dir_all; @@ -12,18 +12,9 @@ pub fn aur_install(a: Vec, options: Options) { let cachedir = format!("{}/.cache/ame/", env::var("HOME").unwrap()); let verbosity = options.verbosity; let noconfirm = options.noconfirm; - match verbosity { - 0 => {} - 1 => { - eprintln!("Installing from AUR:"); - eprintln!("{:?}", &a); - } - _ => { - eprintln!("Installing from AUR:"); - for b in &a { - eprintln!("{:?}", b); - } - } + + if verbosity >= 1 { + log(format!("Installing from AUR: {:?}", &a)); } info(format!("Installing packages {} from the AUR", a.join(", "))); @@ -38,7 +29,7 @@ pub fn aur_install(a: Vec, options: Options) { let pkg = &rpcres.package.as_ref().unwrap().name; if verbosity >= 1 { - eprintln!("Cloning {} into cachedir", pkg); + log(format!("Cloning {} into cachedir", pkg)); } info("Cloning package source".to_string()); @@ -52,15 +43,15 @@ pub fn aur_install(a: Vec, options: Options) { .expect("Something has gone wrong"); if verbosity >= 1 { - eprintln!( + log(format!( "Cloned {} into cachedir, moving on to resolving dependencies", pkg - ); - eprintln!( + )); + log(format!( "Raw dependencies for package {} are:\n{:?}", pkg, rpcres.package.as_ref().unwrap().depends.join(", ") - ) + )); } // dep sorting @@ -68,7 +59,10 @@ pub fn aur_install(a: Vec, options: Options) { let sorted = crate::internal::sort(&rpcres.package.as_ref().unwrap().depends, options); if verbosity >= 1 { - eprintln!("Sorted dependencies for {} are:\n{:?}", pkg, &sorted) + log(format!( + "Sorted dependencies for {} are:\n{:?}", + pkg, &sorted + )); } let newopts = Options { @@ -78,10 +72,13 @@ pub fn aur_install(a: Vec, options: Options) { }; if !sorted.nf.is_empty() { - panic!( - "Could not find dependencies {} for package {}, aborting", - sorted.nf.join(", "), - pkg + crash( + format!( + "Could not find dependencies {} for package {}, aborting", + sorted.nf.join(", "), + pkg + ), + 1, ); } diff --git a/src/operations/install.rs b/src/operations/install.rs index 0380ddc..91c7b63 100644 --- a/src/operations/install.rs +++ b/src/operations/install.rs @@ -1,4 +1,4 @@ -use crate::{info, Options}; +use crate::{info, log, Options}; pub fn install(mut a: Vec, options: Options) { info(format!("Installing packages {} from repos", &a.join(", "))); @@ -10,18 +10,8 @@ pub fn install(mut a: Vec, options: Options) { a.push("--asdeps".to_string()); } let verbosity = options.verbosity; - match verbosity { - 0 => {} - 1 => { - eprintln!("Installing from repos:"); - eprintln!("{:?}", &b); - } - _ => { - eprintln!("Installing from repos:"); - for b in &a { - eprintln!("{:?}", b); - } - } + if verbosity >= 1 { + log(format!("Installing from repos: {:?}", &b)); } let r = runas::Command::new("pacman") @@ -33,7 +23,10 @@ pub fn install(mut a: Vec, options: Options) { if let Some(x) = r.code() { if verbosity >= 1 { - eprintln!("Installing packages: {:?} exited with code {}", &b, x) + log(format!( + "Installing packages: {:?} exited with code {}", + &b, x + )); } } } diff --git a/src/operations/search.rs b/src/operations/search.rs index 8ad115b..90027f2 100644 --- a/src/operations/search.rs +++ b/src/operations/search.rs @@ -1,5 +1,5 @@ use crate::internal::rpc::rpcsearch; -use crate::Options; +use crate::{log, Options}; use std::process::Command; pub fn aur_search(a: &str, options: Options) { @@ -7,7 +7,10 @@ pub fn aur_search(a: &str, options: Options) { let res = rpcsearch(a.to_string()); if verbosity >= 1 { - eprintln!("Found {} results for \"{}\" in AUR", res.resultcount, a); + log(format!( + "Found {} resuls for \"{}\" in AUR", + res.resultcount, a + )); } for r in &res.results { @@ -33,11 +36,11 @@ pub fn repo_search(a: &str, options: Options) { let str = String::from_utf8(rs.stdout).unwrap(); if verbosity >= 1 { - eprintln!( + log(format!( "Found {} results for \"{}\" in repos", &str.split('\n').count() / 2, &a - ); + )); } print!("{}", str); diff --git a/src/operations/uninstall.rs b/src/operations/uninstall.rs index 6d6b79a..888109f 100644 --- a/src/operations/uninstall.rs +++ b/src/operations/uninstall.rs @@ -1,4 +1,4 @@ -use crate::Options; +use crate::{log, Options}; use std::path::Path; use std::{env, fs}; @@ -8,18 +8,8 @@ pub fn uninstall(mut a: Vec, options: Options) { a.push("--noconfirm".to_string()); } let verbosity = options.verbosity; - match verbosity { - 0 => {} - 1 => { - eprintln!("Uninstalling:"); - eprintln!("{:?}", &b); - } - _ => { - eprintln!("Uninstalling:"); - for b in &a { - eprintln!("{}", b); - } - } + if verbosity >= 1 { + log(format!("Uninstalling: {:?}", &b)); } let r = runas::Command::new("pacman") @@ -30,7 +20,10 @@ pub fn uninstall(mut a: Vec, options: Options) { if let Some(x) = r.code() { if verbosity >= 1 { - eprintln!("Uninstalling packages: {:?} exited with code {}", &b, x) + log(format!( + "Uninstalling packages: {:?} exited with code {}", + &b, x + )); } } @@ -38,7 +31,7 @@ pub fn uninstall(mut a: Vec, options: Options) { crate::database::remove(&b, options); if Path::new(&format!("{}/.cache/ame/{}", env::var("HOME").unwrap(), b)).exists() { if verbosity >= 1 { - eprintln!("Old cache directory found, deleting") + log("Old cache directory found, deleting".to_string()); } fs::remove_dir_all(Path::new(&format!( "{}/.cache/ame/{}", diff --git a/src/operations/upgrade.rs b/src/operations/upgrade.rs index f98b242..b86e906 100644 --- a/src/operations/upgrade.rs +++ b/src/operations/upgrade.rs @@ -1,6 +1,6 @@ use crate::internal::rpc::rpcinfo; use crate::operations::aur_install::aur_install; -use crate::Options; +use crate::{log, Options}; use runas::Command; pub fn upgrade(options: Options) { @@ -13,7 +13,7 @@ pub fn upgrade(options: Options) { } if verbosity >= 1 { - eprintln!("Upgrading repo packages") + log("Upgrading repo packages".to_string()); } Command::new("pacman") @@ -22,7 +22,7 @@ pub fn upgrade(options: Options) { .expect("Something has gone wrong"); if verbosity >= 1 { - eprintln!("Upgrading AUR packages") + log("Upgrading AUR packages".to_string()); } let res = crate::database::query("\"%\"", options);