From a8d1be9536bce6d6be2cf1586c8bac049e820d31 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Sun, 8 Sep 2024 17:21:27 +0200 Subject: save files, real last modified check (doesn't work correctly) --- src/packages/pacman.rs | 14 +++++++------- src/packages/portage.rs | 13 +++++++++++++ 2 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 src/packages/portage.rs (limited to 'src/packages') diff --git a/src/packages/pacman.rs b/src/packages/pacman.rs index 0a9e1ff..b5be4c0 100644 --- a/src/packages/pacman.rs +++ b/src/packages/pacman.rs @@ -1,13 +1,13 @@ use std::process::Command; -use crate::packages::Package; +use super::{Package, PackageManager}; -use super::PackageManager; +use crate::error::{Error, Result}; pub struct Pacman; impl PackageManager for Pacman { - fn get_installed(&self) -> Vec { + 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"]) @@ -25,7 +25,7 @@ impl PackageManager for Pacman { }; let split: Vec<&str> = pkg.split_whitespace().collect(); if split.len() != 2 { - panic!("Unknown Pacman Output"); + return Err(Error::UnknownOutput); }; let explicit = pm_e_pkgs_out.contains(pkg); @@ -33,14 +33,14 @@ impl PackageManager for Pacman { pkgs.push(Package { id: split[0].to_string(), version: split[1].to_string(), - explicit + explicit, }) } - pkgs + Ok(pkgs) } - fn install(&self, pkgs: Vec) { + fn install(&self, _pkgs: Vec) { todo!(); } } diff --git a/src/packages/portage.rs b/src/packages/portage.rs new file mode 100644 index 0000000..6b9e508 --- /dev/null +++ b/src/packages/portage.rs @@ -0,0 +1,13 @@ +use super::PackageManager; + +pub struct Portage; + +impl PackageManager for Portage { + fn get_installed(&self) -> crate::error::Result> { + todo!() + } + + fn install(&self, pkgs: Vec) { + todo!() + } +} -- cgit v1.2.3