use git_next_core::{git, ForgeType};
use kxio::network::Network;
#[derive(Clone, Debug)]
pub enum Forge {
Mock,
#[cfg(feature = "forgejo")]
ForgeJo(git_next_forge_forgejo::ForgeJo),
#[cfg(feature = "github")]
Github(git_next_forge_github::Github),
}
impl Forge {
pub fn create(repo_details: git::RepoDetails, net: Network) -> Box<dyn git::ForgeLike> {
match repo_details.forge.forge_type() {
#[cfg(feature = "forgejo")]
ForgeType::ForgeJo => Box::new(git_next_forge_forgejo::ForgeJo::new(repo_details, net)),
#[cfg(feature = "github")]
ForgeType::GitHub => Box::new(git_next_forge_github::Github::new(repo_details, net)),
ForgeType::MockForge => unreachable!(),
}
}
}
#[cfg(test)]
pub mod tests;