refact(fedora): Changes in Backend trait
Signed-off-by: innocentzero <isfarulhaque@proton.me>
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
use core::panic;
|
||||
use std::collections::HashSet;
|
||||
use std::process::{Command, ExitStatus};
|
||||
use std::process::Command;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use anyhow::Result;
|
||||
|
||||
use crate::backend::backend_trait::{Backend, Switches, Text};
|
||||
use crate::backend::macros::impl_backend_constants;
|
||||
use crate::cmd::run_external_command;
|
||||
use crate::{Group, Package};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -57,7 +58,7 @@ impl Backend for Fedora {
|
||||
}
|
||||
|
||||
/// Install the specified packages.
|
||||
fn install_packages(&self, packages: &[Package], noconfirm: bool) -> Result<ExitStatus> {
|
||||
fn install_packages(&self, packages: &[Package], noconfirm: bool) -> Result<()> {
|
||||
let mut cmd = Command::new("sudo");
|
||||
cmd.arg(self.get_binary());
|
||||
cmd.args(self.get_switches_install());
|
||||
@@ -70,11 +71,10 @@ impl Backend for Fedora {
|
||||
cmd.arg(format!("{p}"));
|
||||
}
|
||||
|
||||
cmd.status()
|
||||
.with_context(|| format!("running command {cmd:?}"))
|
||||
run_external_command(cmd)
|
||||
}
|
||||
|
||||
fn remove_packages(&self, packages: &[Package], noconfirm: bool) -> Result<ExitStatus> {
|
||||
fn remove_packages(&self, packages: &[Package], noconfirm: bool) -> Result<()> {
|
||||
let mut cmd = Command::new("sudo");
|
||||
cmd.arg(self.get_binary());
|
||||
cmd.args(self.get_switches_remove());
|
||||
@@ -87,11 +87,10 @@ impl Backend for Fedora {
|
||||
cmd.arg(format!("{p}"));
|
||||
}
|
||||
|
||||
cmd.status()
|
||||
.with_context(|| format!("running command [{cmd:?}]"))
|
||||
run_external_command(cmd)
|
||||
}
|
||||
|
||||
fn make_dependency(&self, _: &[Package]) -> Result<ExitStatus> {
|
||||
fn make_dependency(&self, _: &[Package]) -> Result<()> {
|
||||
panic!("Not supported by the package manager!")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
pub mod arch;
|
||||
#[cfg(feature = "debian")]
|
||||
pub mod debian;
|
||||
#[cfg(feature = "fedora")]
|
||||
pub mod fedora;
|
||||
pub mod flatpak;
|
||||
pub mod python;
|
||||
|
||||
@@ -18,7 +18,6 @@ pub enum Backends {
|
||||
#[cfg(feature = "debian")]
|
||||
Debian,
|
||||
Flatpak,
|
||||
#[cfg(feature = "fedora")]
|
||||
Fedora,
|
||||
Python,
|
||||
Rust,
|
||||
|
||||
Reference in New Issue
Block a user