pub struct PackageManagerFacade { /* private fields */ }Expand description
Facade providing package manager operations with optional dry-run mode.
Implementations§
Source§impl PackageManagerFacade
impl PackageManagerFacade
Sourcepub fn new(pkg_manager: PackageManager) -> Self
pub fn new(pkg_manager: PackageManager) -> Self
Create a new facade for the given package manager.
Sourcepub fn with_dry_run(self, dry_run: bool) -> Self
pub fn with_dry_run(self, dry_run: bool) -> Self
Enable or disable dry-run mode.
Sourcepub fn with_translate_packages(self, translate: bool) -> Self
pub fn with_translate_packages(self, translate: bool) -> Self
Enable or disable package name translation.
Sourcepub fn package_manager(&self) -> PackageManager
pub fn package_manager(&self) -> PackageManager
Get the package manager type.
Sourcepub fn is_dry_run(&self) -> bool
pub fn is_dry_run(&self) -> bool
Check if dry-run mode is enabled.
Sourcepub fn build_update_indices_cmd(&self) -> (String, Vec<String>)
pub fn build_update_indices_cmd(&self) -> (String, Vec<String>)
Build the command for updating package indices.
Returns the program and args (without sudo prefix).
Sourcepub fn build_upgrade_cmd(&self) -> (String, Vec<String>)
pub fn build_upgrade_cmd(&self) -> (String, Vec<String>)
Build the command for upgrading all packages.
Sourcepub fn build_install_cmd(&self, packages: &[&str]) -> (String, Vec<String>)
pub fn build_install_cmd(&self, packages: &[&str]) -> (String, Vec<String>)
Build the command for installing packages.
Package names are translated if translation is enabled.
Sourcepub fn build_remove_cmd(&self, packages: &[&str]) -> (String, Vec<String>)
pub fn build_remove_cmd(&self, packages: &[&str]) -> (String, Vec<String>)
Build the command for removing packages.
Sourcepub fn build_purge_cmd(&self, packages: &[&str]) -> (String, Vec<String>)
pub fn build_purge_cmd(&self, packages: &[&str]) -> (String, Vec<String>)
Build the command for purging packages (remove with config files).
Sourcepub fn build_is_installed_cmd(&self, package: &str) -> (String, Vec<String>)
pub fn build_is_installed_cmd(&self, package: &str) -> (String, Vec<String>)
Build the command for checking if a package is installed.
Returns the program and args for the query command. The package name is translated if translation is enabled.
Sourcepub fn build_search_cmd(&self, query: &str) -> (String, Vec<String>)
pub fn build_search_cmd(&self, query: &str) -> (String, Vec<String>)
Build the command for searching packages.
Sourcepub fn build_info_cmd(&self, package: &str) -> (String, Vec<String>)
pub fn build_info_cmd(&self, package: &str) -> (String, Vec<String>)
Build the command for showing package info.
Sourcepub fn update_indices(&self) -> Result<Option<DryRunResult>, Error>
pub fn update_indices(&self) -> Result<Option<DryRunResult>, Error>
Update package indices.
In dry-run mode, returns a DryRunResult without executing.
Sourcepub fn install(&self, packages: &[&str]) -> Result<Option<DryRunResult>, Error>
pub fn install(&self, packages: &[&str]) -> Result<Option<DryRunResult>, Error>
Install packages.
In dry-run mode, returns a DryRunResult without executing.
Sourcepub fn remove(&self, packages: &[&str]) -> Result<Option<DryRunResult>, Error>
pub fn remove(&self, packages: &[&str]) -> Result<Option<DryRunResult>, Error>
Remove packages.
Sourcepub fn purge(&self, packages: &[&str]) -> Result<Option<DryRunResult>, Error>
pub fn purge(&self, packages: &[&str]) -> Result<Option<DryRunResult>, Error>
Purge packages (remove with configuration files).
Trait Implementations§
Source§impl Clone for PackageManagerFacade
impl Clone for PackageManagerFacade
Source§fn clone(&self) -> PackageManagerFacade
fn clone(&self) -> PackageManagerFacade
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PackageManagerFacade
impl RefUnwindSafe for PackageManagerFacade
impl Send for PackageManagerFacade
impl Sync for PackageManagerFacade
impl Unpin for PackageManagerFacade
impl UnsafeUnpin for PackageManagerFacade
impl UnwindSafe for PackageManagerFacade
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more