#[derive(Clone)]
pub struct InstallationEntry {
pub name: String,
pub properties: std::collections::HashMap<String, String>,
}
pub struct Context {
pub config: DarlingConfig,
}
pub struct DarlingConfig {
pub source_location: String,
}
impl std::default::Default for DarlingConfig {
fn default() -> Self {
Self {
source_location: std::env::var("HOME").unwrap() + "/.local/share/darling/source",
}
}
}
pub trait PackageManager: Send + Sync {
fn name(&self) -> String;
fn install(&self, context: &Context, package: &InstallationEntry) -> anyhow::Result<()>;
fn post_install(&self, _context: &Context) -> anyhow::Result<()> {
Ok(())
}
fn uninstall(&self, context: &Context, package: &InstallationEntry) -> anyhow::Result<()>;
fn get_all_explicit(&self, context: &Context) -> anyhow::Result<Vec<(String, String)>>;
}