From 553bbac36bdc483135a7053ca64507e01397e5e1 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Mon, 9 Sep 2024 23:03:49 +0200 Subject: add package manager recognition --- src/packages/pacman.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/packages/pacman.rs') diff --git a/src/packages/pacman.rs b/src/packages/pacman.rs index e10c6fb..0ad463b 100644 --- a/src/packages/pacman.rs +++ b/src/packages/pacman.rs @@ -1,13 +1,13 @@ use std::process::{Command, Stdio}; -use super::{Package, PackageManager}; +use super::{Package, PackageList, PackageManager}; use crate::error::{Error, Result}; pub struct Pacman; impl PackageManager for Pacman { - fn get_installed(&self) -> Result> { + fn get_installed(&self) -> Result { let pm_pkgs = Command::new("pacman").args(["-Q"]).output().unwrap(); let pm_e_pkgs = Command::new("pacman") .args(["-Q", "--explicit"]) @@ -37,16 +37,19 @@ impl PackageManager for Pacman { }); } - Ok(pkgs) + Ok(PackageList { + packages: pkgs, + manager: super::Manager::Pacman, + }) } fn install(&self, pkgs: Vec) -> Result<()> { - let mut args = vec!["--noconfirm".to_string(), "-S".to_string()]; + let mut args = vec!["pacman".to_string(), "--noconfirm".to_string(), "-S".to_string()]; for pkg in pkgs { args.push(pkg.id); } - Command::new("pacman") + Command::new("doas") .stdout(Stdio::inherit()) .args(args) .spawn()? -- cgit v1.2.3