pub struct PackageManager {
pub name: String,
pub version: String,
pub config_dir: PathBuf,
pub install: Option<String>,
pub install_local: Option<String>,
pub remove: Option<String>,
pub remove_local: Option<String>,
pub search: Option<String>,
}
Expand description
The representation of a package manager. Includes the name of the package manager, a path to reference scripts from, and commands in string form (or scripts to call package manager commands and properly format the output).
Fields§
§name: String
§version: String
§config_dir: PathBuf
§install: Option<String>
§install_local: Option<String>
§remove: Option<String>
§remove_local: Option<String>
§search: Option<String>
Implementations§
Source§impl PackageManager
impl PackageManager
Sourcepub fn exists(&self) -> bool
pub fn exists(&self) -> bool
Check if the PackageManager is installed by seeing if the version command exits with a status code of 0.
Sourcepub fn has_command(&self, name: &str) -> bool
pub fn has_command(&self, name: &str) -> bool
Check if the specified command field of the struct is some
Sourcepub fn run_command(&self, name: &str, args: &str) -> Result<Child, Error>
pub fn run_command(&self, name: &str, args: &str) -> Result<Child, Error>
Attempt to run the PackageManager command specified by name. Arguments can be supplied with the args parameter.
Sourcepub fn install(&self, args: &str) -> Result<Child, Error>
pub fn install(&self, args: &str) -> Result<Child, Error>
Run the install command with the provided arguments
Sourcepub fn uninstall(&self, args: &str) -> Result<Child, Error>
pub fn uninstall(&self, args: &str) -> Result<Child, Error>
Run the uninstall command with the provided arguments
Sourcepub fn search(&self, args: &str) -> Result<Child, Error>
pub fn search(&self, args: &str) -> Result<Child, Error>
Run the search command with the provided arguments
Sourcepub fn get_config_dir(self) -> PathBuf
pub fn get_config_dir(self) -> PathBuf
Get the directory of the configuration file that describes the PackageManager
Sourcepub fn get_version(self) -> Result<Version, Error>
pub fn get_version(self) -> Result<Version, Error>
Get the Version of the package manager
Trait Implementations§
Source§impl Clone for PackageManager
impl Clone for PackageManager
Source§fn clone(&self) -> PackageManager
fn clone(&self) -> PackageManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more