Better search output + out of date warning

i18n
Michal S 2 years ago
parent cb9928471e
commit 5776a80cff
No known key found for this signature in database
GPG Key ID: A6A1A4DCB22279B9

@ -17,6 +17,9 @@ pub struct Package {
#[serde(rename = "OptDepends")]
#[serde(default)]
pub opt_depends: Vec<String>,
#[serde(rename = "OutOfDate")]
#[serde(default)]
pub out_of_date: Option<usize>,
}
#[derive(serde::Deserialize)]

@ -259,6 +259,19 @@ pub fn aur_install(a: Vec<String>, 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);

@ -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());
}
}

Loading…
Cancel
Save