From 2b7c2b39a671fd206f29bec99165b1578b4890ab Mon Sep 17 00:00:00 2001 From: steven-omaha <35634100+steven-omaha@users.noreply.github.com> Date: Thu, 23 Feb 2023 15:32:55 +0100 Subject: [PATCH] make arch report actual binary in use --- crates/pacdef_core/src/backend/actual/arch.rs | 7 ++++++- crates/pacdef_core/src/backend/backend_trait.rs | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/pacdef_core/src/backend/actual/arch.rs b/crates/pacdef_core/src/backend/actual/arch.rs index f031a37..0f84649 100644 --- a/crates/pacdef_core/src/backend/actual/arch.rs +++ b/crates/pacdef_core/src/backend/actual/arch.rs @@ -15,7 +15,7 @@ pub struct Arch { pub(crate) packages: HashSet, } -const BINARY: Text = "paru"; +const BINARY: Text = "pacman"; const SECTION: Text = "arch"; const SWITCHES_INFO: Switches = &["--query", "--info"]; @@ -26,6 +26,11 @@ const SWITCHES_REMOVE: Switches = &["--remove", "--recursive"]; impl Backend for Arch { impl_backend_constants!(); + fn get_binary_inner(&self) -> Text { + let r#box = self.binary.clone().into_boxed_str(); + Box::leak(r#box) + } + fn get_all_installed_packages(&self) -> Result> { let alpm_packages = get_all_installed_packages_from_alpm() .context("getting all installed packages from alpm")?; diff --git a/crates/pacdef_core/src/backend/backend_trait.rs b/crates/pacdef_core/src/backend/backend_trait.rs index 78de8bd..2a00cc4 100644 --- a/crates/pacdef_core/src/backend/backend_trait.rs +++ b/crates/pacdef_core/src/backend/backend_trait.rs @@ -13,6 +13,9 @@ pub(in crate::backend) type Text = &'static str; pub trait Backend: Debug { fn get_binary(&self) -> Text; + fn get_binary_inner(&self) -> Text { + self.get_binary() + } fn get_section(&self) -> Text; fn get_switches_info(&self) -> Switches;