You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
amethyst/src/operations/search.rs

40 lines
946 B
Rust

use crate::error::SilentUnwrap;
use crate::internal::rpc::rpcsearch;
use crate::{log, pacman, Options};
3 years ago
pub fn aur_search(a: &str, options: Options) {
let verbosity = options.verbosity;
let res = rpcsearch(a.to_string());
for r in &res.results {
println!(
"aur/{} {}\n {}",
r.name,
r.version,
r.description
.as_ref()
.unwrap_or(&"No description".to_string())
3 years ago
)
}
if verbosity >= 1 {
log(format!(
"Found {} resuls for \"{}\" in AUR",
res.resultcount, a
));
}
3 years ago
}
pub fn repo_search(a: &str, options: Options) {
let verbosity = options.verbosity;
let output = pacman(&["-Ss", a]).silent_unwrap();
3 years ago
if verbosity >= 1 {
log(format!(
"Found {} results for \"{}\" in repos",
&output.split('\n').count() / 2,
3 years ago
&a
));
3 years ago
}
}