From 13009935f675aac7a9485dcad9393a9a70e4cdca Mon Sep 17 00:00:00 2001 From: michal Date: Mon, 17 Jan 2022 17:06:49 +0000 Subject: [PATCH] testing initial repo package sorting --- src/internal/sort.rs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/internal/sort.rs b/src/internal/sort.rs index 9fc69db..3adf350 100644 --- a/src/internal/sort.rs +++ b/src/internal/sort.rs @@ -1,4 +1,5 @@ -use crate::internal::{structs, rpc}; +use crate::internal::{rpc, structs}; +use std::process::{Command, Stdio}; pub fn sort(a: &[String], verbosity: i32) -> structs::Sorted { #[allow(unused_mut)] @@ -21,6 +22,16 @@ pub fn sort(a: &[String], verbosity: i32) -> structs::Sorted { } for b in a { + let out = Command::new("pacman") + .arg("-Ss") + .arg(format!("^{}$", &b)) + .stdout(Stdio::null()) + .status() + .expect("Something has gone wrong."); + if let Some(0) = out.code() { + repo.push(b.to_string()); + } + if rpc::rpcinfo(b.to_string()).found { if verbosity >= 1 { eprintln!("{} found in AUR.", b); @@ -34,9 +45,5 @@ pub fn sort(a: &[String], verbosity: i32) -> structs::Sorted { } } - structs::Sorted::new( - repo, - aur, - nf - ) -} \ No newline at end of file + structs::Sorted::new(repo, aur, nf) +}