From cf64bb0f722573e5738fcc4260c3baf80e357fc9 Mon Sep 17 00:00:00 2001 From: Book-reader Date: Thu, 4 Apr 2024 18:59:06 +1300 Subject: [PATCH] improve regex and comment regex --- crates/pacdef_core/src/backend/actual/void.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/pacdef_core/src/backend/actual/void.rs b/crates/pacdef_core/src/backend/actual/void.rs index abc6f92..51e9091 100644 --- a/crates/pacdef_core/src/backend/actual/void.rs +++ b/crates/pacdef_core/src/backend/actual/void.rs @@ -50,7 +50,9 @@ impl Backend for Void { impl_backend_constants!(); fn get_all_installed_packages(&self) -> Result> { - let re_str_1 = r"ii | .*"; + // Removes the package status and description from output + let re_str_1 = r"^ii |^uu |^hr |^\?\? | .*"; + // Removes the package version from output let re_str_2 = r"-[^-]*$"; let re1 = Regex::new(re_str_1)?; let re2 = Regex::new(re_str_2)?; @@ -70,6 +72,7 @@ impl Backend for Void { } fn get_explicitly_installed_packages(&self) -> Result> { + // Removes the package version from output let re_str = r"-[^-]*$"; let re = Regex::new(re_str)?; let mut cmd = Command::new(self.get_binary_info());