diff options
author | fx <[email protected]> | 2024-09-23 18:56:39 +0200 |
---|---|---|
committer | fx <[email protected]> | 2024-09-23 18:56:39 +0200 |
commit | ec30fbab6ea45dcdec7d242fba2ff5555fea8e02 (patch) | |
tree | 131070807461d4808e17c34060d853e0985529ac /src/packages.rs | |
parent | 0ed94b3f011a2d3c22bdc4affb502720be22c371 (diff) | |
download | arbs-ec30fbab6ea45dcdec7d242fba2ff5555fea8e02.tar arbs-ec30fbab6ea45dcdec7d242fba2ff5555fea8e02.tar.gz arbs-ec30fbab6ea45dcdec7d242fba2ff5555fea8e02.zip |
add dnf package manager
Diffstat (limited to 'src/packages.rs')
-rw-r--r-- | src/packages.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/packages.rs b/src/packages.rs index de818f4..2844a9b 100644 --- a/src/packages.rs +++ b/src/packages.rs | |||
@@ -1,11 +1,13 @@ | |||
1 | use std::{fs::File, io::Read}; | 1 | use std::{fs::File, io::Read}; |
2 | 2 | ||
3 | use dnf::Dnf; | ||
3 | use pacman::Pacman; | 4 | use pacman::Pacman; |
4 | use portage::Portage; | 5 | use portage::Portage; |
5 | use serde::{Deserialize, Serialize}; | 6 | use serde::{Deserialize, Serialize}; |
6 | 7 | ||
7 | use crate::error::{Error, Result}; | 8 | use crate::error::{Error, Result}; |
8 | 9 | ||
10 | mod dnf; | ||
9 | mod pacman; | 11 | mod pacman; |
10 | mod portage; | 12 | mod portage; |
11 | 13 | ||
@@ -32,6 +34,7 @@ pub struct Package { | |||
32 | 34 | ||
33 | #[derive(Debug, Clone, clap::ValueEnum, Serialize, Deserialize)] | 35 | #[derive(Debug, Clone, clap::ValueEnum, Serialize, Deserialize)] |
34 | pub enum Manager { | 36 | pub enum Manager { |
37 | Dnf, | ||
35 | Pacman, | 38 | Pacman, |
36 | Portage, | 39 | Portage, |
37 | } | 40 | } |
@@ -65,6 +68,7 @@ impl Manager { | |||
65 | 68 | ||
66 | fn from_str(value: &str) -> Result<Box<dyn PackageManager>> { | 69 | fn from_str(value: &str) -> Result<Box<dyn PackageManager>> { |
67 | Ok(match value { | 70 | Ok(match value { |
71 | "fedora" => Box::new(Dnf), | ||
68 | "arch" => Box::new(Pacman), | 72 | "arch" => Box::new(Pacman), |
69 | "gentoo" => Box::new(Portage), | 73 | "gentoo" => Box::new(Portage), |
70 | _ => return Err(Error::Unsupported), | 74 | _ => return Err(Error::Unsupported), |
@@ -73,6 +77,7 @@ impl Manager { | |||
73 | 77 | ||
74 | fn to_package_manager(&self) -> Box<dyn PackageManager> { | 78 | fn to_package_manager(&self) -> Box<dyn PackageManager> { |
75 | match self { | 79 | match self { |
80 | Self::Dnf => Box::new(Dnf), | ||
76 | Self::Pacman => Box::new(Pacman), | 81 | Self::Pacman => Box::new(Pacman), |
77 | Self::Portage => Box::new(Portage), | 82 | Self::Portage => Box::new(Portage), |
78 | } | 83 | } |