From 97896023cf5b8ac9a58baaba7d0571b0cc9ff8f7 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Sun, 8 Sep 2024 23:59:39 +0200 Subject: add logging --- src/packages/pacman.rs | 18 ++++++++++++++---- src/packages/portage.rs | 5 ++++- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'src/packages') diff --git a/src/packages/pacman.rs b/src/packages/pacman.rs index b5be4c0..e10c6fb 100644 --- a/src/packages/pacman.rs +++ b/src/packages/pacman.rs @@ -1,4 +1,4 @@ -use std::process::Command; +use std::process::{Command, Stdio}; use super::{Package, PackageManager}; @@ -34,13 +34,23 @@ impl PackageManager for Pacman { id: split[0].to_string(), version: split[1].to_string(), explicit, - }) + }); } Ok(pkgs) } - fn install(&self, _pkgs: Vec) { - todo!(); + fn install(&self, pkgs: Vec) -> Result<()> { + let mut args = vec!["--noconfirm".to_string(), "-S".to_string()]; + + for pkg in pkgs { + args.push(pkg.id); + } + Command::new("pacman") + .stdout(Stdio::inherit()) + .args(args) + .spawn()? + .wait_with_output()?; + Ok(()) } } diff --git a/src/packages/portage.rs b/src/packages/portage.rs index 6b9e508..f9a760b 100644 --- a/src/packages/portage.rs +++ b/src/packages/portage.rs @@ -1,3 +1,5 @@ +use tracing::error; + use super::PackageManager; pub struct Portage; @@ -7,7 +9,8 @@ impl PackageManager for Portage { todo!() } - fn install(&self, pkgs: Vec) { + fn install(&self, pkgs: Vec) -> crate::error::Result<()> { + error!("Install {pkgs:?}"); todo!() } } -- cgit v1.2.3