use anyhow::Result;
use async_trait::async_trait;
pub mod cargo;
pub mod homebrew;
pub mod path;
pub use cargo::CargoManager;
pub use homebrew::HomebrewManager;
pub use path::PathManager;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum PackageManagerType {
Homebrew,
Cargo,
}
#[derive(Debug, Clone)]
pub struct InstallStatus {
pub installed: bool,
pub version: Option<String>,
pub manager: PackageManagerType,
}
#[async_trait]
pub trait PackageManager: Send + Sync {
fn manager_type(&self) -> PackageManagerType;
async fn is_available(&self) -> bool;
async fn check_installed(&self, package: &str) -> Result<bool>;
async fn install(&self, package: &str, args: &[String]) -> Result<()>;
async fn get_version(&self, package: &str) -> Result<Option<String>>;
}