Add flatpak_systemwide option

This commit is contained in:
teackot
2023-05-16 18:32:29 +03:00
parent d03c338503
commit 6f10c789eb
3 changed files with 12 additions and 0 deletions
@@ -10,6 +10,7 @@ use crate::{impl_backend_constants, Group, Package};
#[derive(Debug, Clone)]
pub struct Flatpak {
pub(crate) packages: HashSet<Package>,
pub(crate) systemwide: bool,
}
const BINARY: Text = "flatpak";
@@ -43,6 +44,7 @@ impl Flatpak {
pub(crate) fn new() -> Self {
Self {
packages: HashSet::new(),
systemwide: true,
}
}
+3
View File
@@ -13,6 +13,8 @@ pub struct Config {
pub aur_helper: String,
/// Additional arguments to pass to `aur_helper` when removing a package.
pub aur_rm_args: Option<Vec<String>>,
/// Install Flatpak packages system-wide
pub flatpak_systemwide: bool,
/// Warn the user when a group is not a symlink.
pub warn_not_symlinks: bool,
/// Backends the user does not want to use even though the binary exists.
@@ -68,6 +70,7 @@ impl Default for Config {
Self {
aur_helper: "paru".into(),
aur_rm_args: None,
flatpak_systemwide: true,
warn_not_symlinks: true,
disabled_backends: vec![],
}
+7
View File
@@ -128,6 +128,13 @@ impl Pacdef {
arch.aur_rm_args = self.config.aur_rm_args.take();
}
}
#[cfg(feature = "flatpak")]
{
if let Some(flatpak) = backend.as_any_mut().downcast_mut::<crate::backend::Flatpak>() {
flatpak.systemwide = self.config.flatpak_systemwide;
}
}
}
fn install_packages(&mut self, args: &ArgMatches) -> Result<()> {