make arch report actual binary in use

This commit is contained in:
steven-omaha
2023-02-23 15:32:55 +01:00
parent 4a0ced581d
commit 2b7c2b39a6
2 changed files with 9 additions and 1 deletions
@@ -15,7 +15,7 @@ pub struct Arch {
pub(crate) packages: HashSet<Package>, pub(crate) packages: HashSet<Package>,
} }
const BINARY: Text = "paru"; const BINARY: Text = "pacman";
const SECTION: Text = "arch"; const SECTION: Text = "arch";
const SWITCHES_INFO: Switches = &["--query", "--info"]; const SWITCHES_INFO: Switches = &["--query", "--info"];
@@ -26,6 +26,11 @@ const SWITCHES_REMOVE: Switches = &["--remove", "--recursive"];
impl Backend for Arch { impl Backend for Arch {
impl_backend_constants!(); 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<HashSet<Package>> { fn get_all_installed_packages(&self) -> Result<HashSet<Package>> {
let alpm_packages = get_all_installed_packages_from_alpm() let alpm_packages = get_all_installed_packages_from_alpm()
.context("getting all installed packages from alpm")?; .context("getting all installed packages from alpm")?;
@@ -13,6 +13,9 @@ pub(in crate::backend) type Text = &'static str;
pub trait Backend: Debug { pub trait Backend: Debug {
fn get_binary(&self) -> Text; fn get_binary(&self) -> Text;
fn get_binary_inner(&self) -> Text {
self.get_binary()
}
fn get_section(&self) -> Text; fn get_section(&self) -> Text;
fn get_switches_info(&self) -> Switches; fn get_switches_info(&self) -> Switches;