summaryrefslogtreecommitdiff
path: root/src/packages.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/packages.rs')
-rw-r--r--src/packages.rs5
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 @@
1use std::{fs::File, io::Read}; 1use std::{fs::File, io::Read};
2 2
3use dnf::Dnf;
3use pacman::Pacman; 4use pacman::Pacman;
4use portage::Portage; 5use portage::Portage;
5use serde::{Deserialize, Serialize}; 6use serde::{Deserialize, Serialize};
6 7
7use crate::error::{Error, Result}; 8use crate::error::{Error, Result};
8 9
10mod dnf;
9mod pacman; 11mod pacman;
10mod portage; 12mod 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)]
34pub enum Manager { 36pub 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 }