diff --git a/src/internal/rpc.rs b/src/internal/rpc.rs index 80e4168..bf0cb67 100644 --- a/src/internal/rpc.rs +++ b/src/internal/rpc.rs @@ -17,6 +17,9 @@ pub struct Package { #[serde(rename = "OptDepends")] #[serde(default)] pub opt_depends: Vec, + #[serde(rename = "OutOfDate")] + #[serde(default)] + pub out_of_date: Option, } #[derive(serde::Deserialize)] diff --git a/src/operations/aur_install.rs b/src/operations/aur_install.rs index f89a64b..8cf1205 100644 --- a/src/operations/aur_install.rs +++ b/src/operations/aur_install.rs @@ -259,6 +259,19 @@ pub fn aur_install(a: Vec, options: Options, orig_cachedir: &str) { // Get package name let pkg = &rpcres.package.as_ref().unwrap().name; + let ood = rpcres.package.as_ref().unwrap().out_of_date; + + // If package is out of date, warn user + if ood.is_some() { + warn!( + "Package {} is out of date, it might be broken, not install or not build properly", + pkg + ); + let p = prompt!(default false, "Would you like to continue?"); + if !p { + break; + } + } // Clone package into cachedir clone(pkg, &pkgcache, &options); diff --git a/src/operations/search.rs b/src/operations/search.rs index 6cb3260..3c95633 100644 --- a/src/operations/search.rs +++ b/src/operations/search.rs @@ -2,7 +2,9 @@ use crate::internal::commands::ShellCommand; use crate::internal::error::SilentUnwrap; use crate::internal::exit_code::AppExitCode; use crate::internal::rpc::rpcsearch; -use crate::{log, Options}; +use crate::{info, log, Options}; + +use colored::Colorize; #[allow(clippy::module_name_repetitions)] pub fn aur_search(query: &str, options: Options) { @@ -15,9 +17,15 @@ pub fn aur_search(query: &str, options: Options) { // Format output for package in &res.results { println!( - "aur/{} {}\n {}", - package.name, - package.version, + "{}{} {} {}\n {}", + "aur/".cyan().bold(), + package.name.bold(), + package.version.green().bold(), + if package.out_of_date.is_some() { + "[out of date]".red().bold() + } else { + "".bold() + }, package .description .as_ref() @@ -25,6 +33,10 @@ pub fn aur_search(query: &str, options: Options) { ); } + if res.results.is_empty() { + info!("No results found for \"{}\" in the AUR", query); + } + if verbosity >= 1 { log!("Found {} resuls for \"{}\" in AUR", res.resultcount, query); } @@ -51,5 +63,9 @@ pub fn repo_search(query: &str, options: Options) { ); } - println!("{}", output); + if output.trim().is_empty() { + info!("No results found for \"{}\" in the repos", query); + } else { + println!("{}", output.trim()); + } }