summaryrefslogtreecommitdiff
path: root/src/packages/pacman.rs
diff options
context:
space:
mode:
authorfxqnlr <[email protected]>2024-09-09 23:03:49 +0200
committerfxqnlr <[email protected]>2024-09-09 23:03:49 +0200
commit553bbac36bdc483135a7053ca64507e01397e5e1 (patch)
tree494dad0623628df4f1b86b93da51edf60795a901 /src/packages/pacman.rs
parentd396881816cd256cb12d03deebea445cba99ea85 (diff)
downloadarbs-553bbac36bdc483135a7053ca64507e01397e5e1.tar
arbs-553bbac36bdc483135a7053ca64507e01397e5e1.tar.gz
arbs-553bbac36bdc483135a7053ca64507e01397e5e1.zip
add package manager recognition
Diffstat (limited to 'src/packages/pacman.rs')
-rw-r--r--src/packages/pacman.rs13
1 files changed, 8 insertions, 5 deletions
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 @@
1use std::process::{Command, Stdio}; 1use std::process::{Command, Stdio};
2 2
3use super::{Package, PackageManager}; 3use super::{Package, PackageList, PackageManager};
4 4
5use crate::error::{Error, Result}; 5use crate::error::{Error, Result};
6 6
7pub struct Pacman; 7pub struct Pacman;
8 8
9impl PackageManager for Pacman { 9impl PackageManager for Pacman {
10 fn get_installed(&self) -> Result<Vec<super::Package>> { 10 fn get_installed(&self) -> Result<PackageList> {
11 let pm_pkgs = Command::new("pacman").args(["-Q"]).output().unwrap(); 11 let pm_pkgs = Command::new("pacman").args(["-Q"]).output().unwrap();
12 let pm_e_pkgs = Command::new("pacman") 12 let pm_e_pkgs = Command::new("pacman")
13 .args(["-Q", "--explicit"]) 13 .args(["-Q", "--explicit"])
@@ -37,16 +37,19 @@ impl PackageManager for Pacman {
37 }); 37 });
38 } 38 }
39 39
40 Ok(pkgs) 40 Ok(PackageList {
41 packages: pkgs,
42 manager: super::Manager::Pacman,
43 })
41 } 44 }
42 45
43 fn install(&self, pkgs: Vec<super::Package>) -> Result<()> { 46 fn install(&self, pkgs: Vec<super::Package>) -> Result<()> {
44 let mut args = vec!["--noconfirm".to_string(), "-S".to_string()]; 47 let mut args = vec!["pacman".to_string(), "--noconfirm".to_string(), "-S".to_string()];
45 48
46 for pkg in pkgs { 49 for pkg in pkgs {
47 args.push(pkg.id); 50 args.push(pkg.id);
48 } 51 }
49 Command::new("pacman") 52 Command::new("doas")
50 .stdout(Stdio::inherit()) 53 .stdout(Stdio::inherit())
51 .args(args) 54 .args(args)
52 .spawn()? 55 .spawn()?