summaryrefslogtreecommitdiff
path: root/src/packages.rs
diff options
context:
space:
mode:
authorfxqnlr <[email protected]>2024-11-01 22:22:18 +0100
committerfxqnlr <[email protected]>2024-11-01 22:22:18 +0100
commit6b3cdf3e3d4417caa8f9d622561696a8d50c86aa (patch)
tree961f699e0b871d17460fbb1e6887c8b04ede9e32 /src/packages.rs
parent7179fa0262c92b124e5d444754a572b2cecbf5cd (diff)
downloadarbs-apt.tar
arbs-apt.tar.gz
arbs-apt.zip
add basic apt compatabilityapt
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 8efc928..3ff997d 100644
--- a/src/packages.rs
+++ b/src/packages.rs
@@ -1,5 +1,6 @@
1use std::{fs::File, io::Read}; 1use std::{fs::File, io::Read};
2 2
3use apt::Apt;
3use dnf::Dnf; 4use dnf::Dnf;
4use pacman::Pacman; 5use pacman::Pacman;
5use portage::Portage; 6use portage::Portage;
@@ -7,6 +8,7 @@ use serde::{Deserialize, Serialize};
7 8
8use crate::error::{Error, Result}; 9use crate::error::{Error, Result};
9 10
11mod apt;
10mod dnf; 12mod dnf;
11mod pacman; 13mod pacman;
12mod portage; 14mod portage;
@@ -34,6 +36,7 @@ pub struct Package {
34 36
35#[derive(Debug, Clone, clap::ValueEnum, Serialize, Deserialize)] 37#[derive(Debug, Clone, clap::ValueEnum, Serialize, Deserialize)]
36pub enum Manager { 38pub enum Manager {
39 Apt,
37 Dnf, 40 Dnf,
38 Pacman, 41 Pacman,
39 Portage, 42 Portage,
@@ -65,6 +68,7 @@ impl Manager {
65 68
66 fn from_str(value: &str) -> Result<Self> { 69 fn from_str(value: &str) -> Result<Self> {
67 Ok(match value { 70 Ok(match value {
71 "debian" | "ubuntu" |"linuxmint" => Self::Apt,
68 "fedora" => Self::Dnf, 72 "fedora" => Self::Dnf,
69 "arch" => Self::Pacman, 73 "arch" => Self::Pacman,
70 "gentoo" => Self::Portage, 74 "gentoo" => Self::Portage,
@@ -74,6 +78,7 @@ impl Manager {
74 78
75 pub fn to_package_manager(&self) -> Box<dyn PackageManager> { 79 pub fn to_package_manager(&self) -> Box<dyn PackageManager> {
76 match self { 80 match self {
81 Self::Apt => Box::new(Apt),
77 Self::Dnf => Box::new(Dnf), 82 Self::Dnf => Box::new(Dnf),
78 Self::Pacman => Box::new(Pacman), 83 Self::Pacman => Box::new(Pacman),
79 Self::Portage => Box::new(Portage), 84 Self::Portage => Box::new(Portage),